Python Forum
How to close one of the windows in Tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to close one of the windows in Tkinter
#1
Hey guys. I'm sure it's simple but what is the command to close a current window in Tkinter? I still want the root to be open but I want another window to close when I click a button. Thanks.

scratchmyhead
Reply
#2
to remove, use windowname.destroy() - it's gone

or windowname.withdraw() - removed from screen, but not destroyed

windowname.iconify() - lowered and iconified (click to restore)

there is also lift and lower, which places a window on top of or behind another window, and if they are the same size, and at same location, can be used to cycle several windows.
Reply
#3
(Nov-11-2019, 02:15 AM)Larz60+ Wrote: to remove, use windowname.destroy() - it's gone

or windowname.withdraw() - removed from screen, but not destroyed

windowname.iconify() - lowered and iconified (click to restore)

there is also lift and lower, which places a window on top of or behind another window, and if they are the same size, and at same location, can be used to cycle several windows.

Thanks. It helped me a lot.

what county am i in
Reply
#4
This is very helpful, thank you a lot.

what county am i in
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter two windows instead of one jacksfrustration 7 777 Feb-08-2024, 06:18 PM
Last Post: deanhystad
  pass a variable between tkinter and toplevel windows janeik 10 2,140 Jan-24-2024, 06:44 AM
Last Post: Liliana
  Tkinter multiple windows in the same window tomro91 1 788 Oct-30-2023, 02:59 PM
Last Post: Larz60+
  [Tkinter] Noob question:Using pyttsx3 with tkinter causes program to stop and close, any ideas? Osman_P 4 5,233 Nov-14-2020, 10:51 AM
Last Post: Osman_P
  Dual Tkinter windows and shells Astrikor 6 3,834 Sep-03-2020, 10:09 PM
Last Post: Astrikor
  [Tkinter] How to close all windows when exit program scratchmyhead 3 6,313 May-17-2020, 08:19 AM
Last Post: menator01
  Tkinter scaling windows conten to or with its size not working Detzi 5 4,358 Jan-12-2020, 12:42 PM
Last Post: Detzi
  Using tkinter on Windows to launch python 3 scripts Mocap 1 2,686 Jul-17-2019, 05:16 AM
Last Post: Yoriz
  [Tkinter] Using tkinter and mutiprocess ok on windows, locks up on ubuntu? ice 3 2,617 May-29-2019, 08:44 AM
Last Post: ice
  Int Variables in different Tkinter windows only returning 0 harry76 3 4,082 May-26-2019, 10:24 AM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020