These are quite different situations: when you are typing text into a text field, quite complicated things are being considered. Pushing the A
key results in a letter a
unless the shift key is held down, when you get a A
. If you push either ctrl
or command
then no letter is typed at all, and a quite different event occurs.
PsychoPy, meanwhile, is operating at a very low level, being concerned with things like when a particular key is pushed, and also when it is released. We don’t wait for the sum of a number of keypresses to be interpreted by the operating system before determining what event occurred.
While this is important for things like reaction time studies, as you note, it does cause issues with just needing to handle formatted text input.
Pygame is deprecated in PsychoPy now, and with the new PsychoPy Keyboard
class, we are moving away from Pyglet too, as the new class enables far superior timing abilities.
The good news is that this allows us to make changes to the code as necessary.
Looking at the code you found:
it doesn’t seem like the user can change the definition of those dictionaries at runtime. You could potentially monkey patch the keyboard.py
module, to change the definition of keys to match what you want (you’d still need to handle upper case and so on manually).
But the ideal would be for someone to modify this code, either to allow the keyNames
dictionary to be accessible to users so that can have individual entries altered, or to internally be more responsive to international keyboard settings.