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?

1 Answers1

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.

Brooke Chalmers
  • 368
  • 2
  • 7