I am new for Python! I would like to define a small region for reading the image, not searching the whole screen. I have some code below but not successful:
import pyautogui, time
while True:
if pyautogui.screenshot(region=(666,0, 200, 200)pyautogui.locateOnScreen(r'C:\Users\Lawrence\Desktop\PyTest\image.png', grayscale=True)):
pyautogui.click(1880,15)
time.sleep(0.1)
break
Hopefully somebody can help! Thank you very much!
Perhaps something like this?
import pyautogui, time
while True:
if pyautogui.locateOnScreen(image=r'C:\Users\Lawrence\Desktop\PyTest\image.png', region=(666,0, 200, 200), grayscale=True):
pyautogui.click(1880,15)
time.sleep(0.1)
break