Having some difficulty using an if statement with the checkbuttons. I tried this any many other variations: Python: if checkbutton is selected
uvcheckvar = tk.IntVar()
uvcheckvar.set(0)
c1 = tk.Checkbutton(leftframeobjcol, text="UV", variable = uvcheckvar,
command=reset) #I've tried setting their onvalue = 1 and offvalue = 0 as well
c1.pack()
if checkvar.get() == 1: #or I've tried 'if checkvar.get() and checkvar == 1
print("test")
Doesn't seem to work for some reason. My goal is to have it print something once I click the checkbox (a test at this point. Long term looking to change an array). I can't seem to find the solution as the link provided above does not solve my problem. Surely this is an easy fix somehow? Am I misunderstanding something? Any resource or assistance is appreciated
Aucun commentaire:
Enregistrer un commentaire