locateOnScreen not working on Big Sur
See original GitHub issueAfter upgrading to macOS Big Sur, the function locateOnScreen is unable to find any image.
Steps to reproduce:
- Make sure “myimage.png” is visible on screen
- run this code
pyautogui.locateOnScreen("myimage.png")
Expected result:
The position is returned by the function.
Actual result:
None
is returned by the function.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
Mac OS - Resolution problem / locateonscreen/get position #281
Hello, I have a problem with locate onscreen function. I try to let my python script find a specific picture in the screen...
Read more >python - pyautogui code only working when debugging (with a ...
I want to make a program that automatically cleans my pc with CCleaner, by searching for specific images on the screen, moving the...
Read more >Pyautogui LocateOnScreen not working in full screen - Reddit
I am searching for a cat walking in range of my standing character in a full screen game using pyautogui locateOnScreen(). The problem...
Read more >Big Sur - Screenshots Not working - Apple Discussions
I've tried permissions, I've changed the OS (this problem started for me when KI upgraded to Catalina, and has followed me to Big...
Read more >How to Fix Screenshot on Mac Not Working in 2023?
Why is my screenshot not working on Mac? ... data from macOS Monterey, macOS BigSur 11.0, macOS 10.15, macOS 10.14 (macOS Mojave) and...
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
@cj81499 i agree… this workaround could easily be implemented as a fix… but PyAutoGUI uses PyScreeze by the same author to do most of the work… and nobody seems to be updating that anymore… I’ll try implementing the fix there and do a pull request sometime soon… let’s see if that’ll work…
Edit: actually this workaround can’t be a fix… (or shouldn’t be)… because then every time a user tries to locate something on screen, it would take a screen shot twice… once for the ratio and once to locate…
so a deeper dive into the source code is necessary… take screen shot just once and use it for both measuring pixel ratio and location…
If someone who already worked on this code was aware of this issue, could have easily implemented the fix…
@rez1-inf I think the point is that this is really something the library ought to handle for the user. Correcting for display scaling is not something that I want to spend any time thinking about as a developer trying to throw some GUI automation together. While the workaround you linked is useful, this is still a BIG usability issue imo. At the very least, it should be documented clearly that such a workaround is needed for displays with scaling.