Hi im trying to write a piece of code on python that lists a value in a label depending how many checkbuttons are ticked. why isnt my code working?
var1=IntVar()
var2=IntVar()
var3=IntVar()
inlabel = StringVar()
label = Label (the_window, height = 1,bg = "white",width = 30, textvariable = inlabel,font = ("arial",50,"normal")).pack()
def check():
if(var1 == 0 and var2 == 0 and var3==1):
inlabel.set("odd")
if(var1 == 0 and var2 == 1 and var3==1):
inlabel.set("even")
if(var1 == 1 and var2 == 1 and var3==1):
inlabel.set("odd")
if(var1 == 0 and var2 == 1 and var3==0):
inlabel.set("odd")
if(var1 == 1 and var2 == 1 and var3==0):
inlabel.set("even")
if(var1 == 0 and var2 == 0 and var3==0):
inlabel.set("null")
if(var1 == 1 and var2 == 0 and var3==0):
inlabel.set("odd")
if(var1 == 1 and var2 == 0 and var3==1):
inlabel.set("even")
check1 = Checkbutton(the_window, text= "Gamma",variable=var1,command=check)
check2 = Checkbutton(the_window, text= "Beta",variable=var2,command=check)
check3 = Checkbutton(the_window, text= "Alpha",variable=var3,command=check)
check1.pack(side=RIGHT)
check2.pack()
check3.pack(side=LEFT)
Thanks :)
Checkbuttonetc are defined)