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 calleddestroy
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 theNick
class would only destroy theFrame
it inherits from and thus and will not close the entire program