macOS - `locateOnScreen()` coordinates are off by a factor of 2
See original GitHub issuelocateOnScreen()
works perfectly on Ubuntu Linux but on MacOS it always adds a varying offset.
As X increases, the coordinates returned by locateOnScreen()
increases by a certain ratio, similar for Y but increases slightly less.
Doesn’t matter how many desktop/workspaces I have active, the result is the same.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7
Top Results From Across the Web
PyAutoGUI locate command returning incorrect coordinates ...
I am trying to use pyautogui. locateCenterOnScreen() to find the exact point of an image on a screen, but whenever the coordinates are...
Read more >PyAutoGUI Documentation - Read the Docs
The screen resolution size is returned by the size() function as a tuple of two integers. The current X and Y coordinates of...
Read more >Screenshot Functions - PyAutoGUI documentation
The Locate Functions¶ · locateOnScreen(image, grayscale=False) - Returns (left, top, width, height) coordinate of first found instance of the image on the screen ......
Read more >screenshot your return value will be different from the one ...
If the image is even a pixel off,locateOnScreen()will returnNone.If the image can be found in several places on the screen,locateAllOnScreen()willreturn ...
Read more >How to fix Python 3 PyAutoGUI screenshot error? (macOS)
locateOnScreen('button.png') pyautogui.pixelMatchesColor(x, y, (r, g, b)) im = pyautogui.screenshot(). The error I get is: screencapture: cannot write file ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The factor 2 is devicePixelRatio.
pixelRatio = pyautogui.screenshot().size[0]/pyautogui.size().width
very interesting!