首页 > 解决方案 > 我正在尝试使用 pyautogui 通过 Python 自动化 GUI 应用程序,但是当我使用“locateCenterOnScreen”时,它的 gettig 错误?

问题描述

import pyautogui as py

x,y=py.locateCenterOnScreen(r"C:\Users\vivek-kumar-singh\Desktop\python\Sonata\Start001.PNG")

py.click(x,y)

当我运行此代码时,它有时会工作,但有时会出现错误:

return Point(coords[0] + int(coords[2] / 2), coords[1] + int(coords[3] / 2))

TypeError:“NoneType”对象不可下标

标签: python

解决方案


推荐阅读