How to make a Tkinter window jump to the front?

nathan picture nathan · Dec 12, 2009 · Viewed 66.7k times · Source

How do I get a Tkinter application to jump to the front? Currently, the window appears behind all my other windows and doesn't get focus.

Is there some method I should be calling?

Answer

D K picture D K · Jul 22, 2011

Assuming you mean your application windows when you say "my other windows", you can use the lift() method on a Toplevel or Tk:

root.lift()

If you want the window to stay above all other windows, use:

root.attributes("-topmost", True)

Where root is your Toplevel or Tk. Don't forget the - infront of "topmost"!

To make it temporary, disable topmost right after:

def raise_above_all(window):
    window.attributes('-topmost', 1)
    window.attributes('-topmost', 0)

Just pass in the window you want to raise as a argument, and this should work.