How can I make pyautogui tell me the coordinates of the locateOnScreen function

  automation, pyautogui, python

So my goal for this right now is to be able to receive the coordinates from locateOnScreen function and use that to click something on the screen. I know how to use cordinates to click something on screen but I cant find the coordinates from the locateOnScreen function

This is what I have so far witch finds something on the screen and says if it can see it I just need to grab the cords of where it actually is

from pyautogui import *
import pyautogui
import time
import keyboard
import random

while True:
    if pyautogui.locateOnScreen('x1.png', confidence=0.9) != None:
        print("I can see it")
        time.sleep(1)
    else:
        print("I can not see the X")
        time.sleep(2)

This is "x1.png" if you need it

Source: Python Questions

LEAVE A COMMENT