python - pyautogui.locateCenterOnScreen() 返回 None 而不是坐标

标签 python python-3.4 pyautogui

import pyautogui
print (pyautogui.locateCenterOnScreen("C:\Users\Venkatesh_J\PycharmProjects\mouse_event\mouse_event.png"))

它不返回坐标,而是返回None

最佳答案

当我通过 pyautogui 内置函数而不是 WIN+Printscr 截屏时,我的问题得到了解决,因为如果我们通过 WIN+ 截屏Printscr 那么像素密度和其他图像相关数据可能与pyautogui内置功能不同。
也许这件事对你有用,对我有用。
对于 Ex - wifi.png wifi.png所以首先我截取了完整的截图并从完整的图像中裁剪了它然后我把它放在我下面显示的代码中

import pyautogui
print(pyautogui.locateCenterOnScreen('wifi.png'))

关于python - pyautogui.locateCenterOnScreen() 返回 None 而不是坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32156019/

相关文章:

python - 如何在 Python 上安装 PyGame?

python - 使用 SleekXMPP 连接到 Facebook 聊天

python - 为什么这是错误的? `SomeClass.method is SomeClass.method`

检查列表中不定# of consec 元素是否总和为给定值的 Pythonic 方法

ssh - "Force psuedo-tty allocation"不能转换为 pssh

python - 如何让 pyautogui 将热键变成变量

python - Python DataFrame 中的多级过滤器

python - python2 和 python3 之间的区别 - int() 和 input()

python - pip.exe安装pyautogui安装PyAutoGUI报错

python - 使用区域加速 pyautogui screenshot()