0

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 – Hansi Schmidt Jan 18 at 1:51
  • yep, i mean that i can write in the editor with it or type in simple numbers – Hansi Schmidt Jan 18 at 2:02
  • yep! it works well – Hansi Schmidt Jan 18 at 2:09
  • read the PyGame documentation ... the answer is there – jsotola Jan 18 at 2:24
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, privacy policy and cookie policy

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