[Tutor] Binding Events

prasad rao prasadaraon50 at gmail.com
Mon Feb 9 16:27:52 CET 2009


Hi   I am unable to bind an event to a widget despite of my best efforts.
Some one please help me.


class app:
def __init__(self,root):
frame=Frame(root)
frame.bind('<Button-1>',self.callback)
frame.pack()
self.event=event
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
from Tkinter import *
root=Tk()
xx=app(root,event)
root.mainloop()


Thanks in advance

Prasad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090209/730ede73/attachment.htm>


More information about the Tutor mailing list