Binny,

The only way I could think to get this done was like so:

from Tkinter import *

class Application: # take away the inherited class

        def end(self, event):
                self.master.destroy()

        def createWidgets(self):
                self.lab = Label(text="Hello World")
                self.lab.pack()

        def __init__(self, master):
                self.master = master                                    # 
Create a class version of master:
self.master
                self.frame = Frame(self.master) # Change master to self.master
                self.frame.pack()
                self.createWidgets()
                self.master.bind('<Escape>', self.end)  # Change <Key-Escape> to
<Escape>, link bind to self.end

root = Tk()                     # Use a tk instance
a = Application(root)
root.mainloop()          # Call tk.mainloop()

I am almost certain that I had the same dilemma as you. Good luck. If
you find a better way please post it.

Thanks,

Harlin Seritt

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

Reply via email to