我正在尝试为我玩的游戏创建一个宏。我想使用pyautogui查找带有confidence=(0.2)
的图像,然后将鼠标移动到其位置并单击。我不知道接下来该怎么办。它将找到图像并打印,但当我尝试添加pyautogui.click('forgedspirit.png')
时,我得到一个错误:cannot unpack non-iterable NoneType object
def new_method():
if pyautogui.locateOnScreen('forgespirit.png', confidence=(0.2)) != None:
print("I can see it.")
pyautogui.click('forgespirit.png')
time.sleep(0.5)
else:
print("image not found")
time.sleep(0.5)
new_method()
您应该告诉pyautogui单击图像的坐标,而不是让它单击图像。 试试这个:
相关问题 更多 >
编程相关推荐