My goal for this right now is to be able to receive the coordinates from the pyautogui function locateOnScreen and use the returned coordinates to click an object on the screen. I know how to use coordinates to click on screen but I cannot find the coordinates from the locateOnScreen function
Code
This is what I have so far which finds an object on the screen and determines if the object is visible. I just need to grab the coordinates of the object.
from pyautogui import *
import pyautogui
import time
import keyboard
import random
while True:
if pyautogui.locateOnScreen('x1.png', confidence=0.9) is not None:
print("I can see it")
time.sleep(1)
else:
print("I can not see the X")
time.sleep(2)
x1.png
