[英]Making windows not appear over each other
Is there a way to check if part or an entire window is over/under another window in python? 有没有一种方法来检查部分或整个窗口是否在python中的另一个窗口之上/之下?
I have two windows and I'd like to make them not appear over each other. 我有两个窗口,我想使它们不会彼此重叠。 This is in Windows, using Tkinter.
这在Windows中使用Tkinter。
You can use the methods winfo_rootx
and winfo_rooty
to get the x/y in the upper left corner. 您可以使用
winfo_rootx
和winfo_rooty
方法在winfo_rootx
获取x / y。 You can use winfo_width
and winfo_height
to get the width and height of the window. 您可以使用
winfo_width
和winfo_height
来获取窗口的宽度和高度。 From that it's just a little math to figure out if two windows overlap. 由此,只需计算一下两个窗口是否重叠即可。 You can then use the
geometry
method to position the windows anywhere on the screen. 然后,您可以使用
geometry
方法将窗口放置在屏幕上的任何位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.