Peter said:
There are documentations which say that Tkinter.Toplevel has
a methode .transient(root) which should make the Toplevel window
transient to its root window.
But I never managed to make it work.(W2K Python 2.2.2).
Read tk commands manual:
"""
wm transient window ?master?
If master is specified, then the window manager is informed that window is
a transient window (e.g. pull-down menu) working on behalf of master (where
master is the path name for a top-level window). Some window managers will use
this information to manage window specially.
"""
Nothing is said about which window should have the grab. And in fact, Windows
actually does something when a window is made transient; try this in an
interactive Python session:
You can first notice that the minimize and maximize buttons have disappeared
from the secondary window's title bar, and that the close button has shrinked a
little. Then, if you try to put the main window above the secondary one, you'll
see that you can't. But you can still make the main window active.
So transient is only part of the solution. You also want to set the grab on the
secondary window, and then wait for the secondary window to close. Here is an
example doing that:
--modal.py-------------------------------------------------
from Tkinter import *
root = Tk()
def go():
wdw = Toplevel()
Entry(wdw).pack()
wdw.transient(root)
wdw.grab_set()
root.wait_window(wdw)
print 'done!'
Button(root, text='Go', command=go).pack()
Button(root, text='Quit', command=root.quit).pack()
root.mainloop()
-----------------------------------------------------------
So this is the magical sequence to make a window modal in Tkinter: transient,
grab_set, wait_window.
[snip]
HTH