how to avoid reapiting lines with locateonscreen - 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: how to avoid reapiting lines with locateonscreen (/thread-32342.html) |
how to avoid reapiting lines with locateonscreen - rachidel07 - Feb-04-2021 hello ! there is any solution to avoid repetition lines in python when i search for many images on screen with Pyautogui.locateOnScreen() because i search for six images and this is my code : import pyautogui import time pyautogui.locateOnScreen('img1.png',confidence=0.7) pyautogui.locateOnScreen('img2.png',confidence=0.7) pyautogui.locateOnScreen('img3.png',confidence=0.7) pyautogui.locateOnScreen('img4.png',confidence=0.7) pyautogui.locateOnScreen('img5.png',confidence=0.7) pyautogui.locateOnScreen('img6.png',confidence=0.7) RE: how to avoid reapiting lines with locateonscreen - perfringo - Feb-04-2021 I have no experience with pyautogui but shouldn't simple loop suffice? Something like: for i in range(1, 7): pyautogui.locateOnScreen(f'img{i}.png',confidence=0.7) RE: how to avoid reapiting lines with locateonscreen - rachidel07 - Feb-07-2021 (Feb-04-2021, 12:59 PM)perfringo Wrote: I have no experience with pyautogui but shouldn't simple loop suffice? Something like: i tried it but its didn't work RE: how to avoid reapiting lines with locateonscreen - buran - Feb-07-2021 (Feb-07-2021, 09:17 PM)rachidel07 Wrote: i tried it but its didn't workdidn't work is not very descriptive. probably you did something wrong. show the full traceback |