![]() |
PyAutoGUI issues with detection - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: PyAutoGUI issues with detection (/thread-33535.html) |
PyAutoGUI issues with detection - Bizzy_ - May-03-2021 Hello all, I'm experiencing issues with the image recognition tool (pyautogui.locateOnScreen('/Users/kd/Desktop/image.png', confidence=0.8) I have made a auto clicker script this is the part causing troubles. image = pyautogui.locateCenterOnScreen('/Users/kd/Desktop/image.png', confidence=0.8) pyautogui.click(x=1180, y=160, clicks=1, interval=1, button='left') pyautogui.click(x=1125, y=105, clicks=1, interval=1, button='left') time.sleep(3) pyautogui.locateOnScreen('/Users/kd/Desktop/image.png', confidence=0.8) print(image) if image is None: pyautogui.click(x=1415, y=105, clicks=1, interval=1, button='left') pyautogui.click(x=1165, y=390, clicks=1, interval=1, button='left') pyautogui.click(x=1250, y=467, clicks=1, interval=1, button='left') else: pyautogui.click(image.x / 2, image.y / 2, clicks=1, interval=3, button='left') pyautogui.click(x=1122, y=105, clicks=1, interval=1, button='left')(the coordinate divider is because of a small workaround as my MacBook Pro has higher pixel density and therefore causes problems with the screenshot tool of pyautogui.) But whenever I try to locate and click the image.png its not detecting anything even when the image is right in the screen.. I have searched a lot on the forums but couldn't find a solution. Was hoping someone could help me out as this has been really frustrating me! How can I let my script recognise the images when the script is running? thanks in advance EDIT: The print function also shows that there is no image found even when its right there in the screen. |