Blank SQL values are passed to a function in tkinter

Viewed 24

So here is basically the two functions from my project, the SQL connection is fine, its just that whenever i execute the "clickAddEntry" function, i guess blank values are passed from some reason... In PgAdmin i do see a new entry in the SQL table but all values are blank. Please Help!

    def clickAddEntry(title, username, password, notes):
    insert_query = 'INSERT INTO passlist (title,username,password,notes) VALUES (%s,%s,%s,%s)'
    vals = (title,username,password,notes)
    cur.execute(insert_query,vals)
    conn.commit()


def clickNewEntry():
    nEntry = Tk()
    nEntry.geometry('400x300')
    nEntry.title('New Password Entry')
    nEntry.configure(bg='#FFCC99')

    TitleLabel = Label(nEntry,text='Title:',font = ('Arial', 15),width=10,bg='#FFCC99')
    TitleLabel.place(x=-30,y=0)

    TitleEntry = Entry(nEntry,width=15,font = ('Arial', 12))
    TitleEntry.place(x=50,y=5)

    UsernameLabel = Label(nEntry,text='Username:',font = ('Arial', 15),width=10,bg='#FFCC99')
    UsernameLabel.place(x=-5,y=40)

    UsernameEntry = Entry(nEntry,width=15,font = ('Arial', 12))
    UsernameEntry.place(x=102,y=45)

    PasswordLabel = Label(nEntry,text='Password:',font = ('Arial', 15),width=10,bg='#FFCC99')
    PasswordLabel.place(x=-5,y=83)

    PasswordEntry = Entry(nEntry,width=15,font = ('Arial', 12))
    PasswordEntry.place(x=102,y=88)

    NotesLabel = Label(nEntry,text='Notes:',font = ('Arial', 15),width=10,bg='#FFCC99')
    NotesLabel.place(x=-23,y=125)

    NotesEntry = Entry(nEntry,width=30,font = ('Arial', 12))
    NotesEntry.place(x=65,y=129)

    theTitle = TitleEntry.get()
    theUser = UsernameEntry.get()
    thePass = PasswordEntry.get()
    theNotes = NotesEntry.get()

    AddButton = Button(nEntry,text='Add Entry',font = ('Arial', 15),width=8,command=lambda: clickAddEntry(theTitle, theUser, thePass, theNotes))
    AddButton.place(x=140,y=200)
0 Answers
Related