[Tutor] re Binding Event

Alan Gauld alan.gauld at btinternet.com
Tue Feb 10 11:28:52 CET 2009


"prasad rao" <prasadaraon50 at gmail.com> wrote

> 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)

Should this not be self.callback?

>  def callback(self,event):
>                print "clicked at", event.x, event.y

This looks like a method? Although the indentation is messed up
in the mail so I can't be sure.

>>>> root=Tk()
>>>> xx=app(root)
>>>> root.mainloop()
> hello! there
> hello! there


HTH

Alan G 




More information about the Tutor mailing list