jeudi 13 août 2015

Python tkinter Checkboxes double check/uncheck

I have a problem with tkinter checkboxes in python.

I use two checkButtons in a grid layout.

class GUI (Tk):
...    
    def __init__(self, parent):
        Tk.__init__(self, parent)
        self.parent = parent
        self.varA = 0
        self.varB = 0
        Checkbutton(self, text="Do A", variable=self.varA, command=self.onCheckButtonAPressed).grid(column=1, row=7, sticky='WESN')
        Checkbutton(self, text="Do B", variable=self.varB, command=self.onCheckButtonBPressed).grid(column=2, row=4, sticky='WESN')
...

When I click on one of them, the variable is changed correctly, but with one click on one of them, both are checked/unchecked and I don't know why.. :(




Aucun commentaire:

Enregistrer un commentaire