moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.79k stars 248 forks source link

coordinates get wrong on one screen only #413

Closed H4mb01 closed 3 years ago

H4mb01 commented 3 years ago

Description The mouse Controller and the mouse Listener have different koordinates on one of my screens. I am Using a Laptop at work with a docking station and two Displays. I want to use pynput to create macros to recreate repetitive mousclicks for me. All worked fine because i mainly work on the two extra Displays but when i wanted to rekord a macro on the Screen of my Laptop this started to misalign. To monitor this i tracked in a console for every click i did the coordinates that the on_click function of the Listener got and the coordinates of the mouse Controller with mouse.position. on my two left Screens all match um perfectly like this: Pressed Button.left at (-2516, 400) mouse.postion = (-2516, 400) Pressed Button.left at (-1982, 427) mouse.postion = (-1982, 427) Pressed Button.left at (-1535, 442) mouse.postion = (-1535, 442)

But when i click on the screen of the laptop itself this start to happen:

Pressed Button.left at (458, 772) mouse.postion = (366, 618) Pressed Button.left at (992, 967) mouse.postion = (794, 774) Pressed Button.left at (1779, 831) mouse.postion = (1423, 665)

Possible Solution After playing around a little bit with the settings of my laptop i found out, that reducing the resolution of my Laptops screen fixed that bug. however i don't realy want to demand for everyone who wants to use the script to reduce their resolution. would be nice if someone can look into this bug and/or finds a solution that works on every PC/Laptop

an other idea would be to use the mouse.position attribute instead of the x and y values of the on_click method when saving them. but i didn't have the time to try it out yet

moses-palmer commented 3 years ago

Thank you for your report.

Have you tested the proposed fix for this?

I will assume that this solves your problem and close this issue. If not, please reopen with additional information.