tkinter delete toplevel 1

tkinter delete toplevel

main = Toplevel()

def ded():
	main.destroy()
    
exit = Button(main, text = "Exit", padx = 20 , pady = 10, command = ded)
exit.grid(row = 0, column = 0)

Here is what the above code is Doing:
1. We create a new Toplevel widget called main.
2. We create a new Button widget called exit.
3. We set the command of the button to ded.
4. We place the button in the main window.
5. We define the function ded.
6. We destroy the main window.

Similar Posts