I'm trying to get the value of checkboxes in tkinter so I can have the data from those checkboxes exported into a excel spreadsheet
I've tried having the checkboxes generate iteratively (as they are presently) and making them manually, but no matter what I do, can't get them to give me their values (whether they are checked or not) and it's really stressing me out.
def check():
for movie in movies():
print(button.get())
Button(moviewindow,text="Check",command=check).pack(anchor=S)
for movie in movies():
var1 = IntVar()
button = Checkbutton(moviewindow,
bg=moviewindow_bg,
font=("Times",23),
onvalue=1,
offvalue=0,
text=movie.replace("<strong>","").replace("</strong>",""),
variable=var1).pack(anchor=W)
I expect the code to print either 1 or 0, but I cant get the checkboxes to return their values.
Aucun commentaire:
Enregistrer un commentaire