Enter Pygame Button

I'm trying to catch the Enter button with pygame, and not the Enter button on the keyboard I want - the Enter button under the Backspace button. They are not like that, because when I press the Enter button on the keyboard, the other Enter button does not work.

http://www.pygame.org/docs/ref/key.html

There is documentation about the keys, but there is only the Enter key. I tried these codes:

This works for a keyboard. Enter the button, but the other enter button is not working:

if event.type==pygame.KEYDOWN:
    if event.key==pygame.K_KP_ENTER:
        #some codes

I tried to catch another Enter button with these codes (hopelessly):

if event.type==pygame.KEYDOWN:
    if event.key==pygame.K_ENTER:
        #some codes

But of course, an error appears:

AttributeError: 'module' object has no attribute 'K_ENTER'

Failed to figure out how to catch the Enter button in Backspace.

+4
source share
1 answer

, K_RETURN, " ", .

+5

Source: https://habr.com/ru/post/1569103/


All Articles