When I was thinking about creating an automation tool using the PyAutoGUI library, I thought I had to think about the number of displays installed, the order of connections, and the main display, so I was looking for a way.
Get your display resolution and size
Based on the column above, we have verified that the screeninfo module can obtain the display number, which is the main display, and the resolution.
from screeninfo import get_monitors
for get_monitors():
print(str(m))
Also, I would be happy if I could know the order of the displays, but is there a way to get the order of the displays?
However, I have seen people connecting large and small displays very finely like Tetris, and I think it is not realistic considering them.
I'm wondering if I should create a limitation that only works on the main display.
I think it appears in the data we obtained.
The PyPI and GitHub descriptions also contain data that can be retrieved.
screeninfo 0.8.1
rr-/screeninfo
The main display is that is_primary
is True
.
If you compare the values x
and y
indicating the base point position in the upper left corner of the corresponding screen, you will be able to determine the vertical and horizontal relationship of each screen.
© 2025 OneMinuteCode. All rights reserved.