i use a small USB number pad/number keyboard for my Raspberry. It works well but my problem is, that it does not work with Pygame. I want to use the RETURN key with:

 elif event.type == pygame.KEYDOWN:
  if event.key == pygame.K_RETURN....

But it does not work. Using a "normal" big keyboard works well with Pygame. Can someone help?

  • It means, that Pygame recognize the button from the big keyboard Commented Jan 18, 2019 at 1:51
  • yep, i mean that i can write in the editor with it or type in simple numbers Commented Jan 18, 2019 at 2:02
  • yep! it works well Commented Jan 18, 2019 at 2:09
  • read the PyGame documentation ... the answer is there
    – jsotola
    Commented Jan 18, 2019 at 2:24

1 Answer 1


The PyGame library treats keypad keys different from normal keys. For instance, the normal enter key is defined as pygame.K_RETURN while the keypad enter key is pygame.K_KP_ENTER, so you should replace K_RETURN with K_KP_ENTER in your code. You can find a full list of the key codes here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.