我正在尝试使用pyautogui通过Python自动化GUI应用程序,但是当我使用“locateCenterOnScreen”时,它的gettig错误是什么?

2024-06-12 06:46:52 发布

您现在位置:Python中文网/ 问答频道 /正文

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' object is not subscriptable


Tags: pyimportpngascoordsusersintdesktop