Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pynput import keyboard
- def on_press(key):
- try:
- print('Tecla pressionada: {0}'.format(key.char))
- except AttributeError:
- print('Tecla especial pressionada: {0}'.format(key))
- def on_release(key):
- if key == keyboard.Key.esc:
- return False
- with keyboard.Listener(on_press=on_press, on_release=on_release) as listener:
- listener.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement