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?
I have two windows and I'd like to make them not appear over each other. This is in Windows, using Tkinter.
You can use the methods winfo_rootx
and winfo_rooty
to get the x/y in the upper left corner. You can use winfo_width
and winfo_height
to get the width and height of the window. 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.
精彩评论