question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pyautogui don't find calc button (using locateOnScreen)

See original GitHub issue

Hi, I’m testing pyautogui and I have some problems with locateOnScreen function. It worked sometimes but now it doesn’t work and I don’t know if I’m making something wrong or it is a issue in the function.

Here is my code: myscreen = pyautogui.screenshot('myscreenshot.png') result = pyautogui.locateCenterOnScreen('imgsToFind/botao4.PNG') if result is not None: utility.mouseClick(result)

result always receive None

Here is the image that I’m trying to find: botao4

Here is the screenshot taken by pyautogui: myscreenshot

Can you help me ?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
bjanzencommented, Oct 29, 2018

Try different values for confidence. Old Sikuli programs used 0.7 confidence based on heuristics I believe, so 0.99 is certainly a bit optimistic, IMHO.

result = pyautogui.locateCenterOnScreen(‘imgsToFind/botao4.PNG’, confidence=0.8)

2reactions
mikebvansicklecommented, Nov 7, 2018

@viniciusmaran @bjanzen I didn’t have OpenCV, I’ve not got it running with Python 3.7.x and it’s working great, I feel like my scripts are running at the speed of light now with the confidence parameter working. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Screenshot Functions - PyAutoGUI documentation
The calculator can appear in a slightly different place each time it is launched, ... If the image can't be found on the...
Read more >
Why PyAutoGui LocateOnScreen() only Returns None
The locateOnScreen() function returns None if the image wasn't found on the screen. Remember, the match has to be pixel-perfect in order to ......
Read more >
pyautogui don't find calc button (using locateOnScreen)
Hi, I'm testing pyautogui and I have some problems with locateOnScreen function. It worked sometimes but now it doesn't work and I don't...
Read more >
PyAutoGUI Documentation - Read the Docs
pyautogui.click('button.png') # Find where button.png appears on the screen and ... you can find it on the screen with locateOnScreen(). > ...
Read more >
Pyautogui locate on screen confidence
locate function you call, you can pass the confidence parameter. pyautogui don't find calc button (using locateOnScreen) · Issue #273 , If the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found