Desktopmagic icon indicating copy to clipboard operation
Desktopmagic copied to clipboard

getDisplayRects returns wrong values

Open Ari24-cb24 opened this issue 4 years ago • 2 comments

Hey,

this is an issue which appears in desktopmagic and in the screeninfo library but only seem to appear when I call functions from both of these libraries in my project which is kind of weird (I tried to call these functions in my python shell and both of them gave me a correct output!)

My real screeninfo

I have two monitors, the first one at (x: 0, y: 0, width: 1920, height: 1080) and the second one at (x: 1920, y: 0, width: 1920, height: 1080)

Results

My project:

desktopmagic

desktopmagic.screengrab_win32.getDisplayRects()
> [(0, 0, 1920, 1080), (2400, 0, 4800, 1350)]

screeninfo

screeninfo.get_monitors()
> [Monitor(x=0, y=0, width=1920, height=1080, width_mm=344, height_mm=194, name='\\\\.\\DISPLAY1'), Monitor(x=2400, y=0, width=2400, height=1350, width_mm=531, height_mm=299, name='\\\\.\\DISPLAY2')]

Python Shell

desktopmagic

desktopmagic.screengrab_win32.getDisplayRects()
> [(0, 0, 1536, 864), (1920, 0, 3840, 1080)]

screeninfo

screeninfo.get_monitors()
> [Monitor(x=0, y=0, width=1920, height=1080, width_mm=344, height_mm=194, name='\\\\.\\DISPLAY1'), Monitor(x=1920, y=0, width=1920, height=1080, width_mm=531, height_mm=299, name='\\\\.\\DISPLAY2')]

both libraries seem to use the same function "EnumDisplayMonitors" but in a different way.
screeninfo: https://github.com/rr-/screeninfo/blob/master/screeninfo/enumerators/windows.py#L6
desktopmagic: https://github.com/ludios/Desktopmagic/blob/master/desktopmagic/screengrab_win32.py#L98

My current project: https://github.com/Ari24-cb24/screen-drawer/blob/testing/utils.py (testing branch)
I don't know if that is reproduceable tho.

Ari24-cb24 avatar Apr 17 '21 11:04 Ari24-cb24

This might be related to the known issue mentioned at the end of https://github.com/ludios/Desktopmagic#known-issues - Desktopmagic relies on either 96 DPI or 'Disable display scaling on high DPI settings' on the Python executable to work properly.

ivan avatar Apr 17 '21 12:04 ivan

Thanks @ivan, this worked perfectly! The only thing I don't understand is why this problem only appeared in pycharm and not in the python shell. Both of them uses the same interpreter

Ari24-cb24 avatar Apr 17 '21 13:04 Ari24-cb24