dimanche 14 juillet 2019

How to remove the tick from a tkinter checkbox

There are two checkboxes. When one is ticked I need the other to remove it's tick, supposed it is ticked. How do I do that?

I've tried disabling and enabling the checkboxes with a delay but they return to their initial condition (if it was ticked, it remains ticked).


from tkinter import *


def removetickwoman():
    # something to remove the tick from woman


def removetickman():
    # something to remove the tick from man


root = Tk()
chkvar1 = IntVar()
chkvar2 = IntVar()


check1 = Checkbutton(root, text="man", variable=chkvar3, command=removetickwoman)
check1.pack()
check2 = Checkbutton(root, text="woman", variable=chkvar4, command=removetickman)
check2.pack()

root.mainloop()




Aucun commentaire:

Enregistrer un commentaire