| Reference | Downloads | Github

Keyboard Component cannot get response from Num KeyPad


I’m trying to use a new faster keyboard component, but it cannot get key responses correctly from the numerical keypad.
*I’m using Builder.

I set a keyboard component to end the routine when ‘num_1’ key is pressed, however, the routine did not end even when I pressed ‘num_1’ key.
On the other hand, I set a keyboard component to end the routine when ‘1’ key is pressed, and routine would end when I pressed ‘1’ key as I expected.

I guess the new keyboard component fails to get correct key names from the numerical keypad responses.
In token of that, PsychoPy returns key names such as ‘end’, ‘down’, ‘pagedown’, instead of ‘num_1’, ‘num_2’, ‘num_3’ respectively in the demo script.

Is there any solution for this?
If I remember correctly, I could get key responses from the numerical keypad using the older version.

To get numeric input from the numerical keypad is more friendly for my participants than to get from the alphabet keys.

Thank you in advance,

OS : Win10
PsychoPy version : 3.1.5
Standard Standalone? (y/n) : y


I just want to let you know that I have already resolved this issue by my self, in order to prevent your unnecessary effort.

For a detail of the solution, I will report here again afterward (I’m busy now).


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/ 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.


  1. Find “” file in your psychopy installation directory. (typically under C:/Program Files (x86)/PsychoPy3/Lib/site-packages/psychopy/hardware for Windows10 64-bit)

  2. Make some changes in “” 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.



See Virtual-Key Codes (Winuser.h) - Win32 apps | Microsoft Docs as key codes reference. Note that the reference shows key codes in hexadecimal format.

  1. Save changes.
    If you did not open a script editor as administer, you cannot save changes.

  2. Completed!! Now you can use the numerical keypad for input device in psychopy.

I expect this problem to be fixed in the next update.