Final Tkinter window doesn't close when program terminates Final Tkinter window doesn't close when program terminates tkinter tkinter

Final Tkinter window doesn't close when program terminates


You are creating two instances of Tk(), which you should not.

Other than that; remove the lines:

top = Tk()w = Button(top, text="Close", command=top.destroy)w.pack()top.mainloop()

and it seems to work fine.

Or did I misunderstand what it is that you want...?