【发布时间】:2021-02-24 02:13:19
【问题描述】:
我现在的目标是能够从pyautogui 函数locateOnScreen 接收坐标,并使用返回的坐标单击屏幕上的对象。我知道如何使用坐标点击屏幕,但我无法从 locateOnScreen 函数中找到坐标
代码
这是我目前所拥有的,它在屏幕上找到一个对象并确定该对象是否可见。我只需要抓取对象的坐标。
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
【问题讨论】:
标签: python automation pyautogui