[Tutor] re Binding Event

prasad rao prasadaraon50 at gmail.com
Tue Feb 10 11:14:52 CET 2009


HelloI changed the code as follows.But still the callback function is not
working.
The he() is working well but clicking on the frame has no result.


class app:
  def __init__(self,root):
frame=Frame(root)
frame.bind("<Button-1>", callback)
frame.pack()
self.button=Button(root,text='quit',fg='red',command=frame.quit)
self.button.pack(side='left')
self.hi=Button(root,text='hi',fg='SystemWindowFrame',command=self.hi)
self.hi.pack(side='right')
self.callback
  def hi (self): print 'hello! there'
  def callback(self,event):
                print "clicked at", event.x, event.y


>>> root=Tk()
>>> xx=app(root)
>>> root.mainloop()
hello! there
hello! there
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090210/6622a6d7/attachment.htm>


More information about the Tutor mailing list