Okay so now I'm getting this error:
Error:Traceback (most recent call last):
File "C:\Users\jumbu\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:/Users/jumbu/Desktop/python/test.py", line 22, in submit
c.execute("INSERT INTO Expense_Data.db VALUES (?, ?, ?, ?)", (l1.get(), l2.get(), l3.get(), l4.get()))
AttributeError: 'Label' object has no attribute 'get'
Here's my full code although I'm not too sure if the problem is outside of that chunk I sent beforehandfrom tkinter import * import sqlite3 # Database Creation & Filename conn = sqlite3.connect('Expense_Data.db') # Create Cursor connecting to database c = conn.cursor() # Database Table Creation ''' c.execute("""CREATE TABLE expenses ( name text, monthly_income integer, monthly_budget integer, monthly_cost_in_expenses integer )""") ''' def submit(): c.execute("INSERT INTO Expense_Data.db VALUES (?, ?, ?, ?)", (l1.get(), l2.get(), l3.get(), l4.get())) c.execute("INSERT INTO Expense_Data.db VALUES (?, ?, ?, ?)") # Finalise || Commit Changes conn.commit() # Create Window Object window = Tk() # Define table contents (each row/column) l1 = Label(window, text="Name") l1.grid(row=0, column=0) l2 = Label(window, text="Monthly Income") l2.grid(row=1, column=0) l3 = Label(window, text="Monthly Budget") l3.grid(row=2, column=0) l4 = Label(window, text="Monthly Expenses") l4.grid(row=3, column=0) # Define Entries name_text = StringVar() e1 = Entry(window, textvariable=name_text) e1.grid(row=0, column=1) Monthly_Income_text = StringVar() e2 = Entry(window, textvariable=Monthly_Income_text) e2.grid(row=1, column=1) Monthly_Budget = StringVar() e3 = Entry(window, textvariable=Monthly_Budget) e3.grid(row=2, column=1) Monthly_Expenses = StringVar() e4 = Entry(window, textvariable=Monthly_Expenses) e4.grid(row=3, column=1) # Define ListBox list1 = Listbox(window, height=6, width=35) # check this list1.grid(row=5, column=0, columnspan=2) # Attach scrollbar to the list sb1 = Scrollbar(window) sb1.grid(row=2, column=2, rowspan=6) list1.configure(yscrollcommand=sb1.set) sb1.configure(command=list1.yview) # Define buttons b1 = Button(window, text="View All", width=12) b1.grid(row=2, column=3) b2 = Button(window, text="Search Entry", width=12) b2.grid(row=3, column=3) b3 = Button(window, text="Add Entry", width=12) b3.grid(row=4, column=3) b4 = Button(window, text="Update Selected", width=12, command=submit) b4.grid(row=5, column=3) b5 = Button(window, text="Delete Selected", width=12) b5.grid(row=6, column=3) b6 = Button(window, text="Close", width=12) b6.grid(row=7, column=3) submit_btn = Button(text="Add Record to Database", command=submit) submit_btn.grid(row=6, column=0, columnspan=2,) window.mainloop()