vendredi 14 mai 2021

When i run the code, all my checkboxes get selected.How do i make this stop?

I made a cancel button which removes the boxes i check manually, after i made it i set the command to be the function which you can see in my code.The cancel button works but after i implemented it for some reason all my boxes get checked automatically when i run the code.

Cancel2=tkinter.StringVar()
Cancel3=tkinter.StringVar()
Cancel4=tkinter.StringVar()
Cancel5=tkinter.StringVar()
Cancel6=tkinter.StringVar()
Cancel7=tkinter.StringVar()
Cancel8=tkinter.StringVar()


def cancel() :
    Cancel1.set(0)
    Cancel2.set(0)
    Cancel3.set(0)
    Cancel4.set(0)
    Cancel5.set(0)
    Cancel6.set(0)
    Cancel7.set(0)
    Cancel8.set(0)


window.title("Menu")

c1 = tkinter.Checkbutton(window,text="Pizza("+str(cijenaPizza)+ ")",onvalue=1,offvalue=0,variable=Cancel1)
c1.grid(row=0,column=1,sticky=W)```



Aucun commentaire:

Enregistrer un commentaire