Help needed to solve this "NameError"

senthil arasu senwin30 at gmail.com
Sun Jun 24 22:17:25 EDT 2007


Hi,
Iam new tp python programming.

Iam getting compiler error  when declaring frame instance as local variable.
please find the code


from Tkinter import *

class App:
    def __init__(self, master):
        *frame = Frame(master)
*      frame.pack()
    self.button = Button(frame, text="QUIT", fg="red", command=frame.quit)
     self.button.pack(side=LEFT)
    self.hi_there = Button(frame, text="Hello", command=self.say_hi)
    self.hi_there.pack(side=LEFT)

def say_hi(self):
    print "hi there, everyone!"
root = Tk()
app = App(root)
root.mainloop()

once compiling iam getting the error

Traceback (most recent call last):
  File "C:\chk.py", line 20, in <module>
*    *frame.pack()
*NameError: name 'frame' is not defined
*

thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070624/13023ae0/attachment.html>


More information about the Python-list mailing list