Sometimes, we want to get monitor resolution in Python.
In this article, we’ll look at how to get monitor resolution in Python.
How to get monitor resolution in Python?
To get monitor resolution in Python, we can use the screeninfo
package.
To install it, we run
pip install screeninfo
Then we use it by writing
from screeninfo import get_monitors
for m in get_monitors():
print(str(m))
to call get_monitors
to get the data for all the monitors in the system.
And then we print the values as strings with print
in the loop.
Conclusion
To get monitor resolution in Python, we can use the screeninfo
package.