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
  [WxPython] Return code when closing the dialog ioprst 1 96 Aug-13-2019, 11:47 AM
Last Post: jefsummers
  Extra annoying window mcmxl22 1 168 Jul-03-2019, 05:22 PM
Last Post: ichabod801
  Removing window borders DT2000 1 163 Jun-27-2019, 04:10 AM
Last Post: DT2000
  [split] Closing a window but not the whole program scriptdrache 1 151 Jun-25-2019, 03:43 PM
Last Post: joe_momma
  [PyQt] Window resizing help FesterJester 2 484 Jun-10-2019, 01:59 PM
Last Post: Denni
  [PyQt] New window gunater 0 340 Mar-01-2019, 01:27 PM
Last Post: gunater
  [Tkinter] identify window DPaul 5 585 Feb-18-2019, 07:15 AM
Last Post: DPaul
  [Tkinter] Tkinter window minimize,appear frequency 5 1,274 Dec-28-2018, 02:02 PM
Last Post: frequency
  [Tkinter] Tkinter window issue frequency 4 532 Dec-24-2018, 10:49 AM
Last Post: frequency
  Closing the Programm after stuck in while loop Rigunas 3 386 Dec-17-2018, 10:57 AM
Last Post: Rigunas

Forum Jump:

Users browsing this thread: 1 Guest(s)