I'm trying to find the horizontal width of a monitor in inches or cm (not pixels!) to make a small "ruler" program. DPI would work too.
I'm using PyQt4.
解决方案
try using the QDesktopWidget's width() and height() to get the width and height respectively.
Class reference at QDesktopWidget Class Reference, this will give you the screens size in pixels and then use QX11Info.appDpiX, this will give you the DPI in pixels per inch. Use both the above info to calculate the screen size in inches.
PS: The width() returns the union width, so in case you have multiple screens, it will return union width of all the screens.