![]() |
pyautogui while loop - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: pyautogui while loop (/thread-21534.html) |
pyautogui while loop - Bmart6969 - Oct-03-2019 Having an issue with my script i am trying to get the script to wait until an image is no longer displayed on screen to continue to the next task. Here is what i have hangs up and just keeps posting Please wait. invalid = pyautogui.locateOnScreen("loadingscreen.png", confidence=0.7) time.sleep(8) loading = pyautogui.locateOnScreen("loadingscreen.png", confidence=0.7) print(loading) while loading != invalid: time.sleep(2) print("Please wait") if loading == invalid: print("Success")Was hoping to pull values from the loading screen while it was visible to when it was not to end loop. Does anyone know a way to do this? Sorry for my ignorance this is only the 2nd day of python for me. invalid = pyautogui.locateOnScreen("zdayloadingscreen.png", confidence=0.7) time.sleep(8) loading = pyautogui.locateOnScreen("zdayloadingscreen.png", confidence=0.7) print(loading) while loading != invalid: time.sleep(2) loading = pyautogui.locateOnScreen("zdayloadingscreen.png", confidence=0.7)#Must update value within loop print("Please wait") if loading == invalid: print("Success")Figured it out! |