Why destroy() method doesn't work in my tkinter program? Why destroy() method doesn't work in my tkinter program? tkinter tkinter

Why destroy() method doesn't work in my tkinter program?


The quickest fix would be to replace Nick.destroy() with self.master.destroy()

This is why the ones you've tried do not work:

  • Nick.destroy(): Nick class has no @classmethod called destroy
  • root.destroy(): root is only accessible in the main method and .mainloop is blocking. So by the time you exit from the main loop (via closing the program, ctrl + c, etc) there's no need to destroy the root.
  • self.destroy(): destroying the Nick class would only destroy the Frame it inherits from and thus and will not close the entire program