- 1 year ago
How to get all my system supported screen resolutions in python
Comment
1 / 1
To get all the supported screen resolutions of your system using Python, you can use the screeninfo
library. Here's an example:
pythonimport screeninfo
# Get all the connected screens and their resolutions
screens = screeninfo.get_monitors()
# Iterate through each screen and print its resolution
for screen in screens:
print("Screen Resolution:", screen.width, "x", screen.height)
Make sure you have the screeninfo
library installed before running this code. You can install it using pip
:
shellpip install screeninfo
The screeninfo
library provides a simple interface to get information about connected screens, including their resolutions. By iterating through the screens and accessing the width
and height
attributes, you can retrieve the screen resolutions.
Running the code will output the resolutions of all the connected screens on your system.