Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyautogui.size() gives wrong resolution on Windows 10 laptop #110

Closed
anubhav-s opened this issue Nov 25, 2016 · 5 comments
Closed

pyautogui.size() gives wrong resolution on Windows 10 laptop #110

anubhav-s opened this issue Nov 25, 2016 · 5 comments

Comments

@anubhav-s
Copy link

anubhav-s commented Nov 25, 2016

Description:

pyautogui.size(), pyautogui.position(), pyautogui.moveTo() and some more functions are giving wrong output on Windows 10 and Windows 8 laptops (I tried on Lenovo and Dell). However, things are working fine on desktops with Windows 8 and Windows 10 versions.

Python version: 2.7.12 and 2.7.11

Please see the attached image.

windows10_pyautogui_wrong_resolution

@studioj
Copy link

studioj commented Nov 25, 2016

I also saw this

@glitchassassin
Copy link

glitchassassin commented Nov 25, 2016

Some preliminary research suggests that it might be the screen DPI setting.

In Windows 8, you can right-click on the desktop, select Screen Resolution, and then click "Make text and other items larger or smaller". This might be different for Windows 10, but I believe it still exists.

This changes the "effective resolution" of your screen, which is reported by the GetSystemMetrics routine (which is what pyautogui checks).

@studioj
Copy link

studioj commented Nov 25, 2016

yes indeed that's it.
Put the slider to 100% to get the proper size...
Nice catch @glitchassasin

Anyway, could this be detectable? As the real resolution is different from the 'size' of the desktop?

image

@dragon788
Copy link

#116 has a clever workaround for this it seems.

@asweigart
Copy link
Owner

I've added the DPI scaling fix to 0.9.35, so hopefully this is now fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants