python - 我正在尝试使用 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”对象不可下标
解决方案
推荐阅读
- javascript - Typescript中递归array.map的类型
- python - 在 Python 中随机调用函数并传递给变量
- amazon-web-services - AWS Cloudwatch 仪表板指标图文本大小
- c# - 动态单选按钮列表在下拉列表选择索引更改时丢失其值 - c#
- php - CMB2 - 如何将元框添加到现有选项页面(也由 new_cmb2_box 创建的选项页面)?
- powershell - 使用 powershell 删除 zip 文件夹
- angular - 角度单元测试 window.location.href
- javascript - 如何承诺readline?
- python - 将 url 迭代地传递到 django html 模板 url 标记中
- python - 调用 list() 后无法遍历 csv 文件