python-2.7 - 如何使用 PyAutoGUI 检测按键事件?

标签 python-2.7 pyautogui

如何使用 PyAutoGUI 检测按键事件?在我的研究中,我无法在这个模型中做一个例子:

import pyautogui

num = 0
if pyautogui.press('b'): # I know the right thing is not to use the press, but, what do I put in place?
    num = 1

最佳答案

在 PyAutoGUI 中无法检测击键。您可能想尝试使用 Pynput 模块:https://pypi.org/project/pynput/

关于python-2.7 - 如何使用 PyAutoGUI 检测按键事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53381360/

相关文章:

linux - 当 shell=True 时检测 Popen() 错误

python - 嵌入式 Python 3.5 "python setup.py egg_info"失败,错误代码为 1

python - Pyautogui:带贝塞尔曲线的鼠标移动

python - 在循环中使用 getpixel

python - 如何在 python LDAP 中组合搜索过滤器?

linux - 在 Python 中,在 Linux 上列出目录中的某种类型的文件

python - 将新字典添加到现有字典中作为键的值

python - 如何在没有输入的情况下使用 raw_input

python - 如何在pyautogui中点击图像中心

python - 有没有一种方法可以自动下载 Selenium 项目的最新 Chrome 驱动程序?