Fix Python – How do I get monitor resolution in Python?

Question

Asked By – rectangletangle

What is the simplest way to get monitor resolution (preferably in a tuple)?

Now we will see solution for issue: How do I get monitor resolution in Python?


Answer

On Windows:

from win32api import GetSystemMetrics

print("Width =", GetSystemMetrics(0))
print("Height =", GetSystemMetrics(1))

If you are working with high resolution screen, make sure your python interpreter is HIGHDPIAWARE.

Based on this post.

This question is answered By – Robus

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0