Is it possible to get the physical dimensions (millimeters or otherwise) of a given monitor with Python on macOS?
I was looking at AppKit's NSScreen but it only gives pixel resolution (via frame
) and doesn't seem to report physical size. I'm not sure what other approach I could take.
You should be able to get this info from CGDisplayScreenSize
, which according to the doc returns "the size of the specified display in millimeters".
The Quartz Python library seems to have a binding for it:
from Quartz import CGDisplayScreenSize, CGMainDisplayID
display_id = CGMainDisplayID()
dimensions = CGDisplayScreenSize(display_id)
print(dimensions)