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

mouse.move not moving to correct coordinates #54

Closed
Underslash12 opened this issue Apr 7, 2020 · 2 comments
Closed

mouse.move not moving to correct coordinates #54

Underslash12 opened this issue Apr 7, 2020 · 2 comments

Comments

@Underslash12
Copy link

When using mouse.move(), the coordinates are not correct, ie: if I have this:

mouse.move(0, 1080, absolute=True)
print(mouse.get_position())

it should go to the bottom left (which it does) yet getting the mouse position reveals its actually 863.
If I then do mouse.move(0, 863, absolute=True), it puts me at the bottom left again, further testing reveals it isn't going to the correct spot. This also happens on the x-axis, giving me a max of 1535.

@Underslash12
Copy link
Author

Underslash12 commented Apr 7, 2020

I accidentally found the fix - make sure your program accounts for dpi scaling, you can fix this by using:

import ctypes
awareness = ctypes.c_int()
ctypes.windll.shcore.SetProcessDpiAwareness(2)

hopefully this saves someone a headache.

@danjcosg
Copy link

danjcosg commented May 6, 2020

Thank you! I encountered this issue too, I would definitely consider including this solution in the Docs

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

2 participants