How to keep a Tkinter-Dialog on top of all other windows?

Jeff Epler jepler at unpythonic.net
Wed Jul 2 11:56:28 EDT 2003


On Wed, Jul 02, 2003 at 10:44:43AM -0500, Joe Fromm wrote:
> Windows actually has two z-orders.  Topmost windows and normal windows.  All
> topmost windows are always above normal windows.
> 
> So setting a window into the topmost group will keep it on top of your app
> with one call, but it will remain topmost even if another application is
> activated.  If that is acceptable to you then setting it to topmost is
> indeed a simpler solution.

Oh.

If you just want to enforce window stacking between two toplevels in
your application, you can use "wm transient" for this.
    t = Tkinter.Tk()
    u = Tkinter.Toplevel(t)
    u.wm_transient(t)
    t.mainloop()

however, "wm transient" has other effects (TRANSIENT_STYLE, does not
appear on task bar, etc).

Jeff





More information about the Python-list mailing list