0
I would like to capture the user-clicked keys through Ironpython. I understand a little C#, but I don’t understand how I would do it in Python.
Code:
import clr
clr.AddReference('System.Windows.Forms')
from System.Windows.Forms import KeyEventArgs, Form, Application, Button
class App(Form):
def __init__(self):
self.KeyUp = self.TeclaClicada #Não sei como faria, aqui está o erro.
self.Text = "Capturar tecla"
def TeclaClicada(self, key):
print(key)
form = App()
Application.Run(form)
Possible duplicate of Capturing user keystrokes in Python on Linux
– Luis Alberto Batista