Bottom Page

Thread Rating:
  • 4 Vote(s) - 2.75 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Closing a window but not the whole program
I want to close a window that I created by pressing a button. However if I put exit then it shuts the whole program down. Can anyone help me fix this?[size=medium][/size]
Don't call sys.exit() then. I'm sure tk has a window close method. Maybe something like root.destroy() or frame.destroy().

If that doesn't help, please share some code so we can see what's going on.
you might be able to use lift and lower, which will hide it behind another widget, but of course you need to have another widget large enough to hide behind.
The other method is withdraw, which I believe doesn't actually delete the window and it can be restored. I have used withdraw, but have never tried to redraw a withdrawn window, it could be as simple as issuing another geometry command (place, pack or grid).
Google it for details.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Tkinter] Tkinter window minimize,appear frequency 5 180 Dec-28-2018, 02:02 PM
Last Post: frequency
  [Tkinter] Tkinter window issue frequency 4 163 Dec-24-2018, 10:49 AM
Last Post: frequency
  Closing the Programm after stuck in while loop Rigunas 3 152 Dec-17-2018, 10:57 AM
Last Post: Rigunas
  [Kivy] Unable to get a window, abort. hajary8 0 162 Dec-13-2018, 06:17 PM
Last Post: hajary8
  top level window juliolop 3 352 Nov-07-2018, 02:52 PM
Last Post: juliolop
  Menu bar not showing in gui window mlh 2 355 Sep-09-2018, 10:27 PM
Last Post: mlh
  Plot on gui window macellan85 1 518 Jul-24-2018, 02:12 PM
Last Post: macellan85
  How to add gif to tkinter window? Nwb 0 396 Jul-04-2018, 11:56 AM
Last Post: Nwb
  Inter-window variables? Hopefully 5 545 Jul-02-2018, 03:36 PM
Last Post: Hopefully
  How Can I Do Refresh Window? satrancali 0 1,235 Feb-03-2018, 07:50 AM
Last Post: satrancali

Forum Jump:

Users browsing this thread: 1 Guest(s)