I have a number of roots (frames) in my program. How do I set the command for the OS's exit button (the x at the top of the panel)? I want to make it so that I can close just one pane, not the entire program. I found code for making your own exit button on the frame itself, but I don't want to have to reset the position of all the buttons I already have.
edit: I forgot to mention I'm using Ubuntu
edit2:
root3 = Tk()
root = Tk()
root2 = Tk()
This is how I'm initializig the objects for three frames (I don't have enough reputation to post images). I looked at Toplevel and I think Bryan Oakley means I should do something like this:
frame1 = Toplevel()
frame2 = Toplevel()
frame3 = Toplevel()
However, doing so makes a fourth (empty) frame appear, while the three I need are still intact with all the widgets I need present.
Could you explain the difference between using Tk() and Toplevel() and how each is meant to be used?
I attempted to use Fredrik's solution but I received the following error:
Traceback (most recent call last):
File "GUI_Robot_Control.py", line 823, in <module>
root.protocol("WM_DELETE_WINDOW", root.destroy())
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1630, in wm_protocol
'wm', 'protocol', self._w, name, command)
_tkinter.TclError: can't invoke "wm" command: application has been destroyed
Thanks in advance!