I created a PyPI module for this reason:
pip install screeninfo
The code:
from screeninfo import get_monitors
for m in get_monitors():
print(str(m))
Result:
Monitor(x=3840, y=0, width=3840, height=2160, width_mm=1420, height_mm=800, name="HDMI-0", is_primary=False)
Monitor(x=0, y=0, width=3840, height=2160, width_mm=708, height_mm=399, name="DP-0", is_primary=True)
It supports multi monitor environments. Its goal is to be cross platform; for now it supports Cygwin and X11 but pull requests are totally welcome.