While trying to make a small program in Python, I am getting an: AttributeError: module 'backend' has no...












0















I am trying to write a small program to use at work. It looks like this:



enter image description here



As you can see there are two dropdown menu's. When clicking on one of the buttons on the menu, filling in the other two Entry's (Korte beschrijving, datum) and clicking on Voeg incident toe (Add new incident) it should be saved as an entry in the database. I guess there are a few things not working and I'm getting two errors:



First I got the: "Option menu has no attribute get" error. Then I made two functions:



def drop_down_soort():
soort.get()
window.quit()

def drop_down_user():
user.get()
window.quit()


Now I am getting a new error:



This is the entire code: frontend and backend + error.



from tkinter import *
import backend

def alle_incidenten():
tekst_vak.delete(0,END)
for row in backend.alle():
tekst_vak.insert(END,row)

def drop_down_soort():
soort.get()
window.quit()

def drop_down_user():
user.get()
window.quit()

def voeg_toe():
backend.voeg_toe(drop_down_soort.get(),drop_down_user.get(),
beschrijving_tekst.get(),datum_tekst.get())
tekst_vak.delete(0,END)
tekst_vak.insert(END,(drop_down_soort.get(),drop_down_user.get(),
beschrijving_tekst.get(),datum_tekst.get()))

window=Tk()
window.wm_title("T I T A A N Incidenten Register")

soort = StringVar(window)
soort.set("Soort")

menu = OptionMenu(window, soort, "Incident", "RFC", "Opdracht")
menu.grid(row=0,column=0)

user = StringVar(window)
user.set("User")

user_menu = OptionMenu(window, user, "Jesse", "Jan", "Sirano", "Shannon",
"Niek", "Thomas", "Patrick")
user_menu.grid(row=1,column=0)

l3=Label(window,text="Korte beschrijving")
l3.grid(row=0,column=2)

l4=Label(window,text="Datum")
l4.grid(row=1,column=2)


beschrijving_tekst=StringVar()
l3=Entry(window,textvariable=beschrijving_tekst)
l3.grid(row=0,column=3)

datum_tekst=StringVar()
l4=Entry(window,textvariable=datum_tekst)
l4.grid(row=1,column=3)

tekst_vak=Listbox(window,height=10,width=35)
tekst_vak.grid(row=2,column=0,rowspan=6,columnspan=2)

scrollbar1=Scrollbar(window)
scrollbar1.grid(row=2,column=2,rowspan=10)

tekst_vak.configure(yscrollcommand=scrollbar1.set)
scrollbar1.configure(command=tekst_vak.yview)

b1=Button(window,text="Alle incidenten", width=14, bg='Gray',
command=alle_incidenten)
b1.grid(row=2,column=3)

b2=Button(window,text="Voeg incident toe", width=14, bg='Gray',
command=voeg_toe)
b2.grid(row=3,column=3)

b3=Button(window,text="Pas incident aan", width=14, bg='Gray')
b3.grid(row=4,column=3)

b4=Button(window,text="Verwijder incident", width=14, bg='Red')
b4.grid(row=5,column=3)

b5=Button(window,text="Sluit programma", width=14, bg='Orange')
b5.grid(row=6,column=3)


window.mainloop()


Backend:



import sqlite3

def verbind_met_database():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS titaan_incidenten
(id INTEGER PRIMARY KEY, soort TEXT, user TEXT, beschrijving TEXT,
datum TEXT)")
verbinding.commit
verbinding.close()

def alle():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("SELECT * FROM titaan_incidenten")
rijen=cur.fetchall()
verbinding.close()
return rijen

def voeg_toe(soort,user,beschrijving,datum):
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("INSERT INTO titaan_incidenten VALUES (NULL,?,?,?,?)",
(soort,user,beschrijving,datum))
verbinding.commit()
verbinding.close()

def pas_aan(id,soort,user,beschrijving,datum):
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("UPDATE titaan_incidenten SET
soort=?,user=?,beschrijving=?,datum=? WHERE id=?",
(id,soort,user,beschrijving,datum))
verbinding.commit
verbinding.close()

def verwijder():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("DELETE FROM titaan_incidenten WHERE id=?",(id,))


ERROR:



Exception in Tkinter callback
Traceback (most recent call last):
File "C:UserscriscAnaconda3libtkinter__init__.py", line 1702, in __
call__
return self.func(*args)
File "frontend.py", line 18, in voeg_toe

backend.voeg_toe(drop_down_soort.get(),
drop_down_user.get(),beschrijving_tekst.get(),datum_tekst.get())
AttributeError: 'function' object has no attribute 'get'


For me, working with the dropdown menu's is something I never done before. So maybe the functions I created are not necessary. If somebody could give me some pointers on how to get that menu working, that would be great!



I edited it with the correct error and code. Sorry for the earlier confusion.



Thanks,



Cris










share|improve this question




















  • 1





    This doesn't have anything to do with menus. backend is the module you defined, and you didn't give it an insert function. What are you expecting that to do?

    – Daniel Roseman
    Nov 20 '18 at 9:42











  • You're calling a function-insert- which does not exist!!

    – Ssein
    Nov 20 '18 at 9:48











  • Sorry guys, I edited the code. Now it has the correct code and error.

    – cris Cadinu
    Nov 20 '18 at 10:02
















0















I am trying to write a small program to use at work. It looks like this:



enter image description here



As you can see there are two dropdown menu's. When clicking on one of the buttons on the menu, filling in the other two Entry's (Korte beschrijving, datum) and clicking on Voeg incident toe (Add new incident) it should be saved as an entry in the database. I guess there are a few things not working and I'm getting two errors:



First I got the: "Option menu has no attribute get" error. Then I made two functions:



def drop_down_soort():
soort.get()
window.quit()

def drop_down_user():
user.get()
window.quit()


Now I am getting a new error:



This is the entire code: frontend and backend + error.



from tkinter import *
import backend

def alle_incidenten():
tekst_vak.delete(0,END)
for row in backend.alle():
tekst_vak.insert(END,row)

def drop_down_soort():
soort.get()
window.quit()

def drop_down_user():
user.get()
window.quit()

def voeg_toe():
backend.voeg_toe(drop_down_soort.get(),drop_down_user.get(),
beschrijving_tekst.get(),datum_tekst.get())
tekst_vak.delete(0,END)
tekst_vak.insert(END,(drop_down_soort.get(),drop_down_user.get(),
beschrijving_tekst.get(),datum_tekst.get()))

window=Tk()
window.wm_title("T I T A A N Incidenten Register")

soort = StringVar(window)
soort.set("Soort")

menu = OptionMenu(window, soort, "Incident", "RFC", "Opdracht")
menu.grid(row=0,column=0)

user = StringVar(window)
user.set("User")

user_menu = OptionMenu(window, user, "Jesse", "Jan", "Sirano", "Shannon",
"Niek", "Thomas", "Patrick")
user_menu.grid(row=1,column=0)

l3=Label(window,text="Korte beschrijving")
l3.grid(row=0,column=2)

l4=Label(window,text="Datum")
l4.grid(row=1,column=2)


beschrijving_tekst=StringVar()
l3=Entry(window,textvariable=beschrijving_tekst)
l3.grid(row=0,column=3)

datum_tekst=StringVar()
l4=Entry(window,textvariable=datum_tekst)
l4.grid(row=1,column=3)

tekst_vak=Listbox(window,height=10,width=35)
tekst_vak.grid(row=2,column=0,rowspan=6,columnspan=2)

scrollbar1=Scrollbar(window)
scrollbar1.grid(row=2,column=2,rowspan=10)

tekst_vak.configure(yscrollcommand=scrollbar1.set)
scrollbar1.configure(command=tekst_vak.yview)

b1=Button(window,text="Alle incidenten", width=14, bg='Gray',
command=alle_incidenten)
b1.grid(row=2,column=3)

b2=Button(window,text="Voeg incident toe", width=14, bg='Gray',
command=voeg_toe)
b2.grid(row=3,column=3)

b3=Button(window,text="Pas incident aan", width=14, bg='Gray')
b3.grid(row=4,column=3)

b4=Button(window,text="Verwijder incident", width=14, bg='Red')
b4.grid(row=5,column=3)

b5=Button(window,text="Sluit programma", width=14, bg='Orange')
b5.grid(row=6,column=3)


window.mainloop()


Backend:



import sqlite3

def verbind_met_database():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS titaan_incidenten
(id INTEGER PRIMARY KEY, soort TEXT, user TEXT, beschrijving TEXT,
datum TEXT)")
verbinding.commit
verbinding.close()

def alle():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("SELECT * FROM titaan_incidenten")
rijen=cur.fetchall()
verbinding.close()
return rijen

def voeg_toe(soort,user,beschrijving,datum):
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("INSERT INTO titaan_incidenten VALUES (NULL,?,?,?,?)",
(soort,user,beschrijving,datum))
verbinding.commit()
verbinding.close()

def pas_aan(id,soort,user,beschrijving,datum):
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("UPDATE titaan_incidenten SET
soort=?,user=?,beschrijving=?,datum=? WHERE id=?",
(id,soort,user,beschrijving,datum))
verbinding.commit
verbinding.close()

def verwijder():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("DELETE FROM titaan_incidenten WHERE id=?",(id,))


ERROR:



Exception in Tkinter callback
Traceback (most recent call last):
File "C:UserscriscAnaconda3libtkinter__init__.py", line 1702, in __
call__
return self.func(*args)
File "frontend.py", line 18, in voeg_toe

backend.voeg_toe(drop_down_soort.get(),
drop_down_user.get(),beschrijving_tekst.get(),datum_tekst.get())
AttributeError: 'function' object has no attribute 'get'


For me, working with the dropdown menu's is something I never done before. So maybe the functions I created are not necessary. If somebody could give me some pointers on how to get that menu working, that would be great!



I edited it with the correct error and code. Sorry for the earlier confusion.



Thanks,



Cris










share|improve this question




















  • 1





    This doesn't have anything to do with menus. backend is the module you defined, and you didn't give it an insert function. What are you expecting that to do?

    – Daniel Roseman
    Nov 20 '18 at 9:42











  • You're calling a function-insert- which does not exist!!

    – Ssein
    Nov 20 '18 at 9:48











  • Sorry guys, I edited the code. Now it has the correct code and error.

    – cris Cadinu
    Nov 20 '18 at 10:02














0












0








0








I am trying to write a small program to use at work. It looks like this:



enter image description here



As you can see there are two dropdown menu's. When clicking on one of the buttons on the menu, filling in the other two Entry's (Korte beschrijving, datum) and clicking on Voeg incident toe (Add new incident) it should be saved as an entry in the database. I guess there are a few things not working and I'm getting two errors:



First I got the: "Option menu has no attribute get" error. Then I made two functions:



def drop_down_soort():
soort.get()
window.quit()

def drop_down_user():
user.get()
window.quit()


Now I am getting a new error:



This is the entire code: frontend and backend + error.



from tkinter import *
import backend

def alle_incidenten():
tekst_vak.delete(0,END)
for row in backend.alle():
tekst_vak.insert(END,row)

def drop_down_soort():
soort.get()
window.quit()

def drop_down_user():
user.get()
window.quit()

def voeg_toe():
backend.voeg_toe(drop_down_soort.get(),drop_down_user.get(),
beschrijving_tekst.get(),datum_tekst.get())
tekst_vak.delete(0,END)
tekst_vak.insert(END,(drop_down_soort.get(),drop_down_user.get(),
beschrijving_tekst.get(),datum_tekst.get()))

window=Tk()
window.wm_title("T I T A A N Incidenten Register")

soort = StringVar(window)
soort.set("Soort")

menu = OptionMenu(window, soort, "Incident", "RFC", "Opdracht")
menu.grid(row=0,column=0)

user = StringVar(window)
user.set("User")

user_menu = OptionMenu(window, user, "Jesse", "Jan", "Sirano", "Shannon",
"Niek", "Thomas", "Patrick")
user_menu.grid(row=1,column=0)

l3=Label(window,text="Korte beschrijving")
l3.grid(row=0,column=2)

l4=Label(window,text="Datum")
l4.grid(row=1,column=2)


beschrijving_tekst=StringVar()
l3=Entry(window,textvariable=beschrijving_tekst)
l3.grid(row=0,column=3)

datum_tekst=StringVar()
l4=Entry(window,textvariable=datum_tekst)
l4.grid(row=1,column=3)

tekst_vak=Listbox(window,height=10,width=35)
tekst_vak.grid(row=2,column=0,rowspan=6,columnspan=2)

scrollbar1=Scrollbar(window)
scrollbar1.grid(row=2,column=2,rowspan=10)

tekst_vak.configure(yscrollcommand=scrollbar1.set)
scrollbar1.configure(command=tekst_vak.yview)

b1=Button(window,text="Alle incidenten", width=14, bg='Gray',
command=alle_incidenten)
b1.grid(row=2,column=3)

b2=Button(window,text="Voeg incident toe", width=14, bg='Gray',
command=voeg_toe)
b2.grid(row=3,column=3)

b3=Button(window,text="Pas incident aan", width=14, bg='Gray')
b3.grid(row=4,column=3)

b4=Button(window,text="Verwijder incident", width=14, bg='Red')
b4.grid(row=5,column=3)

b5=Button(window,text="Sluit programma", width=14, bg='Orange')
b5.grid(row=6,column=3)


window.mainloop()


Backend:



import sqlite3

def verbind_met_database():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS titaan_incidenten
(id INTEGER PRIMARY KEY, soort TEXT, user TEXT, beschrijving TEXT,
datum TEXT)")
verbinding.commit
verbinding.close()

def alle():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("SELECT * FROM titaan_incidenten")
rijen=cur.fetchall()
verbinding.close()
return rijen

def voeg_toe(soort,user,beschrijving,datum):
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("INSERT INTO titaan_incidenten VALUES (NULL,?,?,?,?)",
(soort,user,beschrijving,datum))
verbinding.commit()
verbinding.close()

def pas_aan(id,soort,user,beschrijving,datum):
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("UPDATE titaan_incidenten SET
soort=?,user=?,beschrijving=?,datum=? WHERE id=?",
(id,soort,user,beschrijving,datum))
verbinding.commit
verbinding.close()

def verwijder():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("DELETE FROM titaan_incidenten WHERE id=?",(id,))


ERROR:



Exception in Tkinter callback
Traceback (most recent call last):
File "C:UserscriscAnaconda3libtkinter__init__.py", line 1702, in __
call__
return self.func(*args)
File "frontend.py", line 18, in voeg_toe

backend.voeg_toe(drop_down_soort.get(),
drop_down_user.get(),beschrijving_tekst.get(),datum_tekst.get())
AttributeError: 'function' object has no attribute 'get'


For me, working with the dropdown menu's is something I never done before. So maybe the functions I created are not necessary. If somebody could give me some pointers on how to get that menu working, that would be great!



I edited it with the correct error and code. Sorry for the earlier confusion.



Thanks,



Cris










share|improve this question
















I am trying to write a small program to use at work. It looks like this:



enter image description here



As you can see there are two dropdown menu's. When clicking on one of the buttons on the menu, filling in the other two Entry's (Korte beschrijving, datum) and clicking on Voeg incident toe (Add new incident) it should be saved as an entry in the database. I guess there are a few things not working and I'm getting two errors:



First I got the: "Option menu has no attribute get" error. Then I made two functions:



def drop_down_soort():
soort.get()
window.quit()

def drop_down_user():
user.get()
window.quit()


Now I am getting a new error:



This is the entire code: frontend and backend + error.



from tkinter import *
import backend

def alle_incidenten():
tekst_vak.delete(0,END)
for row in backend.alle():
tekst_vak.insert(END,row)

def drop_down_soort():
soort.get()
window.quit()

def drop_down_user():
user.get()
window.quit()

def voeg_toe():
backend.voeg_toe(drop_down_soort.get(),drop_down_user.get(),
beschrijving_tekst.get(),datum_tekst.get())
tekst_vak.delete(0,END)
tekst_vak.insert(END,(drop_down_soort.get(),drop_down_user.get(),
beschrijving_tekst.get(),datum_tekst.get()))

window=Tk()
window.wm_title("T I T A A N Incidenten Register")

soort = StringVar(window)
soort.set("Soort")

menu = OptionMenu(window, soort, "Incident", "RFC", "Opdracht")
menu.grid(row=0,column=0)

user = StringVar(window)
user.set("User")

user_menu = OptionMenu(window, user, "Jesse", "Jan", "Sirano", "Shannon",
"Niek", "Thomas", "Patrick")
user_menu.grid(row=1,column=0)

l3=Label(window,text="Korte beschrijving")
l3.grid(row=0,column=2)

l4=Label(window,text="Datum")
l4.grid(row=1,column=2)


beschrijving_tekst=StringVar()
l3=Entry(window,textvariable=beschrijving_tekst)
l3.grid(row=0,column=3)

datum_tekst=StringVar()
l4=Entry(window,textvariable=datum_tekst)
l4.grid(row=1,column=3)

tekst_vak=Listbox(window,height=10,width=35)
tekst_vak.grid(row=2,column=0,rowspan=6,columnspan=2)

scrollbar1=Scrollbar(window)
scrollbar1.grid(row=2,column=2,rowspan=10)

tekst_vak.configure(yscrollcommand=scrollbar1.set)
scrollbar1.configure(command=tekst_vak.yview)

b1=Button(window,text="Alle incidenten", width=14, bg='Gray',
command=alle_incidenten)
b1.grid(row=2,column=3)

b2=Button(window,text="Voeg incident toe", width=14, bg='Gray',
command=voeg_toe)
b2.grid(row=3,column=3)

b3=Button(window,text="Pas incident aan", width=14, bg='Gray')
b3.grid(row=4,column=3)

b4=Button(window,text="Verwijder incident", width=14, bg='Red')
b4.grid(row=5,column=3)

b5=Button(window,text="Sluit programma", width=14, bg='Orange')
b5.grid(row=6,column=3)


window.mainloop()


Backend:



import sqlite3

def verbind_met_database():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS titaan_incidenten
(id INTEGER PRIMARY KEY, soort TEXT, user TEXT, beschrijving TEXT,
datum TEXT)")
verbinding.commit
verbinding.close()

def alle():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("SELECT * FROM titaan_incidenten")
rijen=cur.fetchall()
verbinding.close()
return rijen

def voeg_toe(soort,user,beschrijving,datum):
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("INSERT INTO titaan_incidenten VALUES (NULL,?,?,?,?)",
(soort,user,beschrijving,datum))
verbinding.commit()
verbinding.close()

def pas_aan(id,soort,user,beschrijving,datum):
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("UPDATE titaan_incidenten SET
soort=?,user=?,beschrijving=?,datum=? WHERE id=?",
(id,soort,user,beschrijving,datum))
verbinding.commit
verbinding.close()

def verwijder():
verbinding=sqlite3.connect("titaan_incidenten.db")
cur=verbinding.cursor()
cur.execute("DELETE FROM titaan_incidenten WHERE id=?",(id,))


ERROR:



Exception in Tkinter callback
Traceback (most recent call last):
File "C:UserscriscAnaconda3libtkinter__init__.py", line 1702, in __
call__
return self.func(*args)
File "frontend.py", line 18, in voeg_toe

backend.voeg_toe(drop_down_soort.get(),
drop_down_user.get(),beschrijving_tekst.get(),datum_tekst.get())
AttributeError: 'function' object has no attribute 'get'


For me, working with the dropdown menu's is something I never done before. So maybe the functions I created are not necessary. If somebody could give me some pointers on how to get that menu working, that would be great!



I edited it with the correct error and code. Sorry for the earlier confusion.



Thanks,



Cris







python tkinter sqlite3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 10:01







cris Cadinu

















asked Nov 20 '18 at 9:41









cris Cadinucris Cadinu

114




114








  • 1





    This doesn't have anything to do with menus. backend is the module you defined, and you didn't give it an insert function. What are you expecting that to do?

    – Daniel Roseman
    Nov 20 '18 at 9:42











  • You're calling a function-insert- which does not exist!!

    – Ssein
    Nov 20 '18 at 9:48











  • Sorry guys, I edited the code. Now it has the correct code and error.

    – cris Cadinu
    Nov 20 '18 at 10:02














  • 1





    This doesn't have anything to do with menus. backend is the module you defined, and you didn't give it an insert function. What are you expecting that to do?

    – Daniel Roseman
    Nov 20 '18 at 9:42











  • You're calling a function-insert- which does not exist!!

    – Ssein
    Nov 20 '18 at 9:48











  • Sorry guys, I edited the code. Now it has the correct code and error.

    – cris Cadinu
    Nov 20 '18 at 10:02








1




1





This doesn't have anything to do with menus. backend is the module you defined, and you didn't give it an insert function. What are you expecting that to do?

– Daniel Roseman
Nov 20 '18 at 9:42





This doesn't have anything to do with menus. backend is the module you defined, and you didn't give it an insert function. What are you expecting that to do?

– Daniel Roseman
Nov 20 '18 at 9:42













You're calling a function-insert- which does not exist!!

– Ssein
Nov 20 '18 at 9:48





You're calling a function-insert- which does not exist!!

– Ssein
Nov 20 '18 at 9:48













Sorry guys, I edited the code. Now it has the correct code and error.

– cris Cadinu
Nov 20 '18 at 10:02





Sorry guys, I edited the code. Now it has the correct code and error.

– cris Cadinu
Nov 20 '18 at 10:02












1 Answer
1






active

oldest

votes


















0














Based on the information you've provided, you're passing the wrong parameters to backend.voeg_toe() function. Rather than using drop_down_soort.get(), drop_down_user.get(), you should pass just these functions without .get() which does not make sense to your function, and return values inside the function.



Function bodies can contain one or more return statement. They can be situated anywhere in the function body. A return statement ends the execution of the function call and "returns" the result, i.e. the value of the expression following the return keyword, to the caller. If the return statement is without an expression, the special value None is returned. If there is no return statement in the function code, the function ends, when the control flow reaches the end of the function body and the value "None" will be returned.



for example:



def drop_down_soort():
test = soort.get() #not sure even if soort.get() is getting any value, but I suppose yes!!!!
window.quit()
return test

def drop_down_user():
test = user.get() #not sure even if user.get() is getting any value, but I suppose yes!!!!
window.quit()
return test


so then whenever you call backend.voeg_toe(drop_down_soort(),drop_down_user(),....) it will get the returning values of those two functions and will pass it as parameters.






share|improve this answer
























  • Still getting the same error when deleting .get(). I want to select something from the dropdown menu's, type something in the Entry boxes and then click on the Voeg Incident Toe button. And that's when I get the same error. So it runs the program, and as soon as I select something from the dropdown buttons and enter some text in the Entry boxes. Finally I click on the widget button and then it returns the error.

    – cris Cadinu
    Nov 20 '18 at 12:45













  • Your code needs to be rewritten a bit. Try to remove the other get() from the function parameters.

    – Ssein
    Nov 20 '18 at 13:02











  • Did you mean: def voeg_toe(): backend.voeg_toe(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst()) tekst_vak.delete(0,END) tekst_vak.insert(END,(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst())) because now I am gettint a different error: StringVar object is not callable.

    – cris Cadinu
    Nov 20 '18 at 17:27













  • It's pointing that beschrijving_tekst() and datum_tekst() are not functions so you can't put () in front of them to pass as parameters. Those aforementioned variables are already =StringVar(), so remove () from beschrijving_tekst() and datum_tekst(), however you still need to work on your code.

    – Ssein
    Nov 21 '18 at 8:43













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53390109%2fwhile-trying-to-make-a-small-program-in-python-i-am-getting-an-attributeerror%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Based on the information you've provided, you're passing the wrong parameters to backend.voeg_toe() function. Rather than using drop_down_soort.get(), drop_down_user.get(), you should pass just these functions without .get() which does not make sense to your function, and return values inside the function.



Function bodies can contain one or more return statement. They can be situated anywhere in the function body. A return statement ends the execution of the function call and "returns" the result, i.e. the value of the expression following the return keyword, to the caller. If the return statement is without an expression, the special value None is returned. If there is no return statement in the function code, the function ends, when the control flow reaches the end of the function body and the value "None" will be returned.



for example:



def drop_down_soort():
test = soort.get() #not sure even if soort.get() is getting any value, but I suppose yes!!!!
window.quit()
return test

def drop_down_user():
test = user.get() #not sure even if user.get() is getting any value, but I suppose yes!!!!
window.quit()
return test


so then whenever you call backend.voeg_toe(drop_down_soort(),drop_down_user(),....) it will get the returning values of those two functions and will pass it as parameters.






share|improve this answer
























  • Still getting the same error when deleting .get(). I want to select something from the dropdown menu's, type something in the Entry boxes and then click on the Voeg Incident Toe button. And that's when I get the same error. So it runs the program, and as soon as I select something from the dropdown buttons and enter some text in the Entry boxes. Finally I click on the widget button and then it returns the error.

    – cris Cadinu
    Nov 20 '18 at 12:45













  • Your code needs to be rewritten a bit. Try to remove the other get() from the function parameters.

    – Ssein
    Nov 20 '18 at 13:02











  • Did you mean: def voeg_toe(): backend.voeg_toe(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst()) tekst_vak.delete(0,END) tekst_vak.insert(END,(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst())) because now I am gettint a different error: StringVar object is not callable.

    – cris Cadinu
    Nov 20 '18 at 17:27













  • It's pointing that beschrijving_tekst() and datum_tekst() are not functions so you can't put () in front of them to pass as parameters. Those aforementioned variables are already =StringVar(), so remove () from beschrijving_tekst() and datum_tekst(), however you still need to work on your code.

    – Ssein
    Nov 21 '18 at 8:43


















0














Based on the information you've provided, you're passing the wrong parameters to backend.voeg_toe() function. Rather than using drop_down_soort.get(), drop_down_user.get(), you should pass just these functions without .get() which does not make sense to your function, and return values inside the function.



Function bodies can contain one or more return statement. They can be situated anywhere in the function body. A return statement ends the execution of the function call and "returns" the result, i.e. the value of the expression following the return keyword, to the caller. If the return statement is without an expression, the special value None is returned. If there is no return statement in the function code, the function ends, when the control flow reaches the end of the function body and the value "None" will be returned.



for example:



def drop_down_soort():
test = soort.get() #not sure even if soort.get() is getting any value, but I suppose yes!!!!
window.quit()
return test

def drop_down_user():
test = user.get() #not sure even if user.get() is getting any value, but I suppose yes!!!!
window.quit()
return test


so then whenever you call backend.voeg_toe(drop_down_soort(),drop_down_user(),....) it will get the returning values of those two functions and will pass it as parameters.






share|improve this answer
























  • Still getting the same error when deleting .get(). I want to select something from the dropdown menu's, type something in the Entry boxes and then click on the Voeg Incident Toe button. And that's when I get the same error. So it runs the program, and as soon as I select something from the dropdown buttons and enter some text in the Entry boxes. Finally I click on the widget button and then it returns the error.

    – cris Cadinu
    Nov 20 '18 at 12:45













  • Your code needs to be rewritten a bit. Try to remove the other get() from the function parameters.

    – Ssein
    Nov 20 '18 at 13:02











  • Did you mean: def voeg_toe(): backend.voeg_toe(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst()) tekst_vak.delete(0,END) tekst_vak.insert(END,(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst())) because now I am gettint a different error: StringVar object is not callable.

    – cris Cadinu
    Nov 20 '18 at 17:27













  • It's pointing that beschrijving_tekst() and datum_tekst() are not functions so you can't put () in front of them to pass as parameters. Those aforementioned variables are already =StringVar(), so remove () from beschrijving_tekst() and datum_tekst(), however you still need to work on your code.

    – Ssein
    Nov 21 '18 at 8:43
















0












0








0







Based on the information you've provided, you're passing the wrong parameters to backend.voeg_toe() function. Rather than using drop_down_soort.get(), drop_down_user.get(), you should pass just these functions without .get() which does not make sense to your function, and return values inside the function.



Function bodies can contain one or more return statement. They can be situated anywhere in the function body. A return statement ends the execution of the function call and "returns" the result, i.e. the value of the expression following the return keyword, to the caller. If the return statement is without an expression, the special value None is returned. If there is no return statement in the function code, the function ends, when the control flow reaches the end of the function body and the value "None" will be returned.



for example:



def drop_down_soort():
test = soort.get() #not sure even if soort.get() is getting any value, but I suppose yes!!!!
window.quit()
return test

def drop_down_user():
test = user.get() #not sure even if user.get() is getting any value, but I suppose yes!!!!
window.quit()
return test


so then whenever you call backend.voeg_toe(drop_down_soort(),drop_down_user(),....) it will get the returning values of those two functions and will pass it as parameters.






share|improve this answer













Based on the information you've provided, you're passing the wrong parameters to backend.voeg_toe() function. Rather than using drop_down_soort.get(), drop_down_user.get(), you should pass just these functions without .get() which does not make sense to your function, and return values inside the function.



Function bodies can contain one or more return statement. They can be situated anywhere in the function body. A return statement ends the execution of the function call and "returns" the result, i.e. the value of the expression following the return keyword, to the caller. If the return statement is without an expression, the special value None is returned. If there is no return statement in the function code, the function ends, when the control flow reaches the end of the function body and the value "None" will be returned.



for example:



def drop_down_soort():
test = soort.get() #not sure even if soort.get() is getting any value, but I suppose yes!!!!
window.quit()
return test

def drop_down_user():
test = user.get() #not sure even if user.get() is getting any value, but I suppose yes!!!!
window.quit()
return test


so then whenever you call backend.voeg_toe(drop_down_soort(),drop_down_user(),....) it will get the returning values of those two functions and will pass it as parameters.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 11:20









SseinSsein

1,0141921




1,0141921













  • Still getting the same error when deleting .get(). I want to select something from the dropdown menu's, type something in the Entry boxes and then click on the Voeg Incident Toe button. And that's when I get the same error. So it runs the program, and as soon as I select something from the dropdown buttons and enter some text in the Entry boxes. Finally I click on the widget button and then it returns the error.

    – cris Cadinu
    Nov 20 '18 at 12:45













  • Your code needs to be rewritten a bit. Try to remove the other get() from the function parameters.

    – Ssein
    Nov 20 '18 at 13:02











  • Did you mean: def voeg_toe(): backend.voeg_toe(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst()) tekst_vak.delete(0,END) tekst_vak.insert(END,(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst())) because now I am gettint a different error: StringVar object is not callable.

    – cris Cadinu
    Nov 20 '18 at 17:27













  • It's pointing that beschrijving_tekst() and datum_tekst() are not functions so you can't put () in front of them to pass as parameters. Those aforementioned variables are already =StringVar(), so remove () from beschrijving_tekst() and datum_tekst(), however you still need to work on your code.

    – Ssein
    Nov 21 '18 at 8:43





















  • Still getting the same error when deleting .get(). I want to select something from the dropdown menu's, type something in the Entry boxes and then click on the Voeg Incident Toe button. And that's when I get the same error. So it runs the program, and as soon as I select something from the dropdown buttons and enter some text in the Entry boxes. Finally I click on the widget button and then it returns the error.

    – cris Cadinu
    Nov 20 '18 at 12:45













  • Your code needs to be rewritten a bit. Try to remove the other get() from the function parameters.

    – Ssein
    Nov 20 '18 at 13:02











  • Did you mean: def voeg_toe(): backend.voeg_toe(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst()) tekst_vak.delete(0,END) tekst_vak.insert(END,(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst())) because now I am gettint a different error: StringVar object is not callable.

    – cris Cadinu
    Nov 20 '18 at 17:27













  • It's pointing that beschrijving_tekst() and datum_tekst() are not functions so you can't put () in front of them to pass as parameters. Those aforementioned variables are already =StringVar(), so remove () from beschrijving_tekst() and datum_tekst(), however you still need to work on your code.

    – Ssein
    Nov 21 '18 at 8:43



















Still getting the same error when deleting .get(). I want to select something from the dropdown menu's, type something in the Entry boxes and then click on the Voeg Incident Toe button. And that's when I get the same error. So it runs the program, and as soon as I select something from the dropdown buttons and enter some text in the Entry boxes. Finally I click on the widget button and then it returns the error.

– cris Cadinu
Nov 20 '18 at 12:45







Still getting the same error when deleting .get(). I want to select something from the dropdown menu's, type something in the Entry boxes and then click on the Voeg Incident Toe button. And that's when I get the same error. So it runs the program, and as soon as I select something from the dropdown buttons and enter some text in the Entry boxes. Finally I click on the widget button and then it returns the error.

– cris Cadinu
Nov 20 '18 at 12:45















Your code needs to be rewritten a bit. Try to remove the other get() from the function parameters.

– Ssein
Nov 20 '18 at 13:02





Your code needs to be rewritten a bit. Try to remove the other get() from the function parameters.

– Ssein
Nov 20 '18 at 13:02













Did you mean: def voeg_toe(): backend.voeg_toe(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst()) tekst_vak.delete(0,END) tekst_vak.insert(END,(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst())) because now I am gettint a different error: StringVar object is not callable.

– cris Cadinu
Nov 20 '18 at 17:27







Did you mean: def voeg_toe(): backend.voeg_toe(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst()) tekst_vak.delete(0,END) tekst_vak.insert(END,(drop_down_soort(),drop_down_user(),beschrijving_tekst(),datum_tekst())) because now I am gettint a different error: StringVar object is not callable.

– cris Cadinu
Nov 20 '18 at 17:27















It's pointing that beschrijving_tekst() and datum_tekst() are not functions so you can't put () in front of them to pass as parameters. Those aforementioned variables are already =StringVar(), so remove () from beschrijving_tekst() and datum_tekst(), however you still need to work on your code.

– Ssein
Nov 21 '18 at 8:43







It's pointing that beschrijving_tekst() and datum_tekst() are not functions so you can't put () in front of them to pass as parameters. Those aforementioned variables are already =StringVar(), so remove () from beschrijving_tekst() and datum_tekst(), however you still need to work on your code.

– Ssein
Nov 21 '18 at 8:43




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53390109%2fwhile-trying-to-make-a-small-program-in-python-i-am-getting-an-attributeerror%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

SQL update select statement

'app-layout' is not a known element: how to share Component with different Modules