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?
Advertisement
Answer
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.