[Python] Why isn't the pygame event KEYDOWN working?

Discussão em 'Python' iniciado por Stack, Maio 23, 2025.

  1. Stack

    Stack Membro Participativo

    for event in pygame.event.get():
    if event.type == pygame.KEYDOWN:
    if event.key == pygame.K_p:
    WINDOW.blit(posX_text, (0, 100))
    WINDOW.blit(posY_text, (0, 150))
    WINDOW.blit(momentumX_text, (0, 200))
    WINDOW.blit(momentumY_text, (0, 250))
    print("debug")


    So I have a problem where I'm trying to make a debug menu in a driving game and I was looking on how to make it so that when I pressed the p key once the menu opened and stayed opened. I saw suggestions to use the event stuff as shown in the code. But nothing happens when I press the p key when I run the code.

    Continue reading...

Compartilhe esta Página