📜  python pynput 字母键被按下 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:28.932000             🧑  作者: Mango

代码示例1
from pynput import keyboard

def on_press(key):
    if key.char == 'a': # here you can choose the letter you want to get detected
        print("You pressed A")

with keyboard.Listener(on_press=on_press) as listener:
    listener.join()