How to fix the problem on the numerical keypad for ver. 3.1.5 on Windows 10 (1809).
Problem: New keyboard component cannot correctly get key responses from the numerical keypad input.
Cause: The key mapping of a psychopy library (psychopy/hardware/keyboard.py) is wrong.
Cautions!! This solution makes partial changes in psychopy library. It is user’s responsibility for the use of this solution. If you’d like to avoid any failure, please wait for official fixes or updates.
Solution:
-
Find “keyboard.py” file in your psychopy installation directory. (typically under C:/Program Files (x86)/PsychoPy3/Lib/site-packages/psychopy/hardware for Windows10 64-bit)
-
Make some changes in “keyboard.py” script (from line 406 to 408), using a script editor.
Make sure to open script editor as administer.
See pictures below for the before-and-after. Those are my VS Code screen.
Before
After
See Virtual-Key Codes (Winuser.h) - Win32 apps | Microsoft Docs as key codes reference. Note that the reference shows key codes in hexadecimal format.
-
Save changes.
If you did not open a script editor as administer, you cannot save changes. -
Completed!! Now you can use the numerical keypad for input device in psychopy.
I expect this problem to be fixed in the next update.
Thanks.
Daiki

