1

Is it possible to get keyboard input of non-alphabetic data (like Chinese, Korean, Japanese) in Pyglet or Pygame?

In MacOS environment with Python3, text string of non-alphabetic can be received without problem in python level. However, Pyglet key functions give error when non-english keyboard input is selected. In contrast, Pygame just ignore keyboard input setting and get lower case alphabet input in the every keyboard.

I checked the codes of Pyglet and Pygame, it seems fundamental issue that non-latin characters are not recognized in Pyglet key input function.

    Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/pyglet/libs/darwin/cocoapy/runtime.py", line 1121, in objc_method
    result = f(py_self, *args)
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/pyglet/window/cocoa/pyglet_view.py", line 158, in pygletKeyDown_
    symbol = getSymbol(nsevent)
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/pyglet/window/cocoa/pyglet_view.py", line 52, in getSymbol
    return charmap[chars[0].upper()]
KeyError: '\u3141'

Anybody succeed to get key input with non-alphabetic keyboard?

iPsych
  • 171
  • 10
  • 1
    it seems problem is `charmap` in `pyglet_view.py` which doesn't have key `'\u3141'` - maybe if you would add this key with any value to `charmap` then it could at least work without error - but it may not give expected values. – furas Jul 21 '19 at 12:27

0 Answers0