event handling in classes?
bgue at my-deja.com
bgue at my-deja.com
Mon May 31 22:23:30 EDT 1999
Hi, I'm stumped on how to accomplish event handling with a Tkinter app
that's a class. I didn't find anything on a Dejanews search either...can
anybody tell me what the following example is doing wrong?
from Tkinter import *
class gui(Frame):
def __init__(self, parent=None):
Frame.__init__(self, parent)
self.grid()
self.bind("<Key>", self.callback)
self.str = ""
self.mainloop()
def callback(self, event):
print event.char
self.str = self.str + event.char
g = gui()
-----
Any help is appreciated. I'm stuck.
Thanks,
Brian
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
More information about the Python-list
mailing list