GameBoard()
creates a new instance of GameBoard . Therefore:
GameBoard().destroy()
creates a new instance and calls destroy() on it, which does not affect the existing instance.
You want to access the current instance in your _close() method, which is done via self :
def _close(self): self.destroy()
However, this only destroys the frame (and its child windows, like a button), and not the top-level window (master).
To completely close the user interface, you can call self.master.destroy() or just self.quit() :
def _close(self): self.quit()
source share