'PyAutoGui locateOnScreen Loop
I've been trying to create a loop where it looks for an image, and if not found scrolls once then tries again until it finds it. Problem is, when it finds it, it doesn't break. I can't figure out why it isnt breaking. Its returns none each scroll, until it finds the image and it returns a location, but once it returns the location it just keeps scrolling.
false = None
while false is None:
try:
none = pyautogui.locateOnScreen('findadobe.png', grayscale=True, confidence=0.7)
time.sleep(1)
scroll(-2600)
pyautogui.moveTo(none)
print(none)
if false is not None:
break
except:
print(none)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
