[Tutor] frame destroy problem

Chris Hare CHARE at labr.net
Thu Nov 3 05:39:04 CET 2011


I have the following code:

        def listUsers(self):
                self.frameBottom = Frame(self.base, bd=0, bg=backColor)
                self.frameBottom.grid(row=1, column=0,sticky=N+E+S+W)
                self.text = Text(self.frameBottom)
                self.text.grid(row=1, column=6, columnspan=5, sticky=E)
                self.text.insert(END, security.listUsers())
                self.btnClose = Button(self.frameBottom, text="Close", command=self.closeFrameBottom,highlightbackground=backColor)
                self.btnClose.grid(row=2, column=4)

        def closeFrameBottom(self):
                self.franeBottom.destroy()

When the listUsers method is called, everything is displayed correctly.  However, when the  btnClose is pressed, I get an error

Exception in Tkinter callback
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__
    return self.func(*args)
  File "z.py", line 454, in closeFrameBottom
    self.franeBottom.destroy()
AttributeError: Display instance has no attribute 'franeBottom'

What have I got wrong? the objective is to use the bottom part opt the window over and over again.

Chris Hare
chare at labr.net
http://www.labr.net



More information about the Tutor mailing list