hi ,i created 3 buttons such that if button1 is clicked it will
disable button2 ,and clicking button3 will restore state of button2 to
normal,

to my dismay i find that button2 still responds to clicks even if it
is greyed out

here is the code..am i doing something wrong? is there a way to truly
disable the button?



class MyApp:
        def __init__(self,parent):
                self.mainframe=Frame(parent)
                self.mainframe.pack()

                #self.canvorig=Canvas(self.mainframe,width=100,height=200)
                #self.canvorig.pack()
                self.button1=Button(self.mainframe,bg="green")
                self.button1.configure(text="1")
                self.button1.pack(side=LEFT)
                self.button1.bind("<Button-1>",self.buttonClick1)
                self.button2=Button(self.mainframe,bg="yellow")
                self.button2.configure(text="2")
                self.button2.pack(side=LEFT)
                self.button2.bind("<Button-1>",self.buttonClick2)
                self.button3=Button(self.mainframe,bg="red")
                self.button3.configure(text="3")
                self.button3.pack(side=RIGHT)
                self.button3.bind("<Button-1>",self.buttonClick3)

        def buttonClick1(self,event):
                print "ok clicked"
                self.button2.configure(state="disabled")
                self.button2.update_idletasks()

        def buttonClick2(self,event):
                print "2 clicked"

        def buttonClick3(self,event):
                print "3 clicked"
                self.button2.configure(state="normal")
                self.button2.update_idletasks()

root = Tk()
myapp = MyApp(root)
root.mainloop()

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to