Jan-02-2022, 08:19 PM
Hello,
I am new to python and cant seem to find an answer to my question.Here is what i am trying to do.
I want to make a loop that for example lastst for 10 seconds. Within those 10 sec I want to find an image, if that image is not found within those 10 sec i want it to run the else statement.
Here is what i have now.
[attachment=1505]
I am new to python and cant seem to find an answer to my question.Here is what i am trying to do.
I want to make a loop that for example lastst for 10 seconds. Within those 10 sec I want to find an image, if that image is not found within those 10 sec i want it to run the else statement.
Here is what i have now.
[attachment=1505]
import pyautogui import time t_end = time.time() + 10 while time.time() < t_end: if pyautogui.locateCenterOnScreen('image.png') is not None: print("found") else: print("Not found within the time frame")