如何使Tkinter窗口跳到前面? [英] How to make a Tkinter window jump to the front?
问题描述
是否有一些方法可以调用?
当你说我的其他窗口时,你的意思是你的应用程序窗口,你可以在Toplevel或Tk上使用 lift()
方法:
root.lift()
您希望窗口保持在所有其他窗口之上,使用:
$ $ $ $ $ $ c $ root.attributes( - topmost,True)
其中根
是您的Toplevel或Tk。不要忘记最顶层的
-
!
def raise_above_all(window):
window.attributes(' - topmost',1)
window.attributes(' - topmost',0)
只要传入你想要提出的参数,就可以了。
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?
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.
这篇关于如何使Tkinter窗口跳到前面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!