Python Forum

Full Version: Closing a window but not the whole program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.