# found a pirate : pirate = pyautogui.locateCenterOnScreen('pirates.png', region=(0, 0, 1920, 1080), grayscale=True, confidence=0.70) if pirate is not None : pyautogui.moveTo(pirate) # move the mouse to the coords of the pirate time.sleep(1) #break 1 second pyautogui.click(pirate[0], pirate[1]) #click the pirate time.sleep(1)