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()