I am writing a small program in Python using Tkinter.The problem is that checkbox can not auto deselect when I choose another option. It still allows to select both options.
C1 = Checkbutton(root, text="Full Screen", variable=CheckVar1,onvalue = 1, offvalue = 0,height=5, width=20).pack side=LEFT, pady=5, padx=2)
C2 = Checkbutton(root, text="Area", variable=CheckVar2,onvalue = 1, offvalue = 0, height=5, width=20).pack(side=RIGHT,pady=5, padx=5)
if CheckVar1.get():
CheckVar2.set(0)[enter image description here][1]
elif CheckVar2.get():
CheckVar1.set(0)
else:
messagebox.showerror('Tk', 'Something went wrong!')
Aucun commentaire:
Enregistrer un commentaire