I have a Python program that involves checking if a key (and which key) is pressed on the keyboard. I use the Python library "pynput". The following minimum code example runs perfectly fine on my raspy 5 with the Thonny IDE and also with the PyCharm IDE. But unfortunately it does not work with the Geany IDE. Pressed keys are just not detected under Geany. Can anyone give me a hint, how I can solve this.
Python minimum code example:
`from pynput import keyboard`
`def on_press(key):` ` try:` ` print('alphanumeric key {0} pressed'.format(key.char))` ` except AttributeError:` ` print('special key {0} pressed'.format(key))`
`def on_release(key):` ` print('{0} released'.format(key))` ` if key == keyboard.Key.esc:` ` return False`
`listener = keyboard.Listener(` ` on_press=on_press,` ` on_release=on_release)` `listener.start()`