import pyHook
import pythoncom
def tecla_pressionada(evento):
# print("Alguma tecla pressionada")
print (chr(evento.Ascii))
hook = pyHook.HookManager()
hook.KeyDown = tecla_pressionada #sem ()
hook.HookKeyboard()
pythoncom.PumpMessages() #cria loop infinito e espera mensagens do SO
The above code works with the pyHook
library for Windows.
How to make a similar code in Python for Linux?