tkinter prob
JyotiC
jyoti.chhabra at gmail.com
Mon Aug 21 02:50:29 EDT 2006
i have tried it out but it's not working.
this is the code
from Tkinter import *
class abc:
def __init__(self,parent):
#make container myparent
self.myparent=parent
self.myparent.geometry("500x200")
#make the initial frame
self.frame=Frame(self.myparent)
self.frame.pack()
self.var=IntVar()
self.var.set(0)
a=Button(self.frame,text="button")
a.pack()
Checkbutton(self.frame,text="hello",variable=self.var,command=self.com(a)).pack()
def com(self,a):
if self.var.get()==1:
a.config(state=ENABLED)
else:
a.config(state=DISABLED)
root=Tk()
abc(root)
root.mainloop()
Fredrik Lundh wrote:
> JyotiC wrote:
>
> > i am making a GUI using Tkinter,
> > I have a button and a checkbutton.
> > i want the button to be enable when checkbutton is on and disble when
> > the checkbutton is off.
>
> use the checkbutton's command option to install a callback that enables
> or disables the button.
>
> </F>
More information about the Python-list
mailing list