I found this link above about buttons not being defined, and it was pretty straight forward. But what if you had an Entry and you needed the value of that Entry for the function that is in the command too.
from tkinter import *
root = Tk()
textfile = open("savings.txt")
def save(maandag):
textfile.write(str(maandag.get()))
maandag = Entry(root, command=save(maandag))
maandag.grid(row=1,column=0,sticky=N+S+W+E, pady=5, columnspan=6, rowspan=2);
root.mainloop()
This will return: NameError: name 'maandag' is not defined, on line 6
What is the proper way to do this?
Aucun commentaire:
Enregistrer un commentaire