mercredi 31 août 2016

How to change a normal button status based on checkbutton status in tkinter

Sample of my code is here. I expect my program to change status of "mb2" button based on checkbutton selection status

cb=Checkbutton(mf,text="Past(X hours)",variable=chkvar,padx=20,relief=GROOVE)
cb.pack(side=RIGHT,anchor=E)
chkvar.set(0)

def conf(self):
    if chkvar.get() == 0 :
            mb2.configure(state='normal')
    if chkvar.get() == 1 :
            mb2.configure(state='disabled')
cb.bind('<Button-1>',conf)




Aucun commentaire:

Enregistrer un commentaire