title: how to destroy an object completely?
body: <p>please help to destroy, in whole self.area </p>
  
  <pre><code>import tkinter
  import tkinter.messagebox
  import sys
  
  
  class TP(tkinter.Frame):
  
      def __init__(self, parent):
          tkinter.Frame.__init__(self, parent)
          self.pack(side = 'top', fill = 'x', expand = 'yes')
          self.parent = parent
          self.make_menu_bar()
  
      def make_menu_bar(self):
          self.menubar = tkinter.Menu(self) 
          self.parent.config(menu = self.menubar)                           
  
          self.file = tkinter.Menu(self.menubar)
          self.file.add_command(label = 'New', command = lambda: self.toggle_area(True))
          self.file.add_command(label = 'Close...', command = lambda: self.toggle_area(False))
          self.menubar.add_cascade(label = 'File', menu = self.file)
  
      def toggle_area(self, action):
          if action:
              self.area = tkinter.Text(self)
              self.area.pack(expand = 'yes', fill = 'both')
              print(sys.getrefcount(self.area))
          else:
              print(sys.getrefcount(self.area))
              self.area.destroy()
              print(sys.getrefcount(self.area))
  
  
  if __name__ == '__main__':
      root = tkinter.Tk()
      TP(root)
      root.mainloop()
  </code></pre>
  
  <p>the problem is that after I select the menu item "Close", the screen shows the number of references to the object self.area. number of references to the object self.area still not 0, and 2. that is, the object is in memory and is not garbage collected </p>