Answers for "pygame key reference"

1

how to get pygame key

# current state of all the keys (pressed, not pressed)
pygame.key.get_pressed
Posted by: Guest on September-01-2021
1

key pressed pygame

letters = {x: pygame.key.key_code(x) for x in "abcdefghijklmnopqrstuvwxyz"}

touche = pygame.key.get-pressed()

for (l, value) in letters.items() :
  if touche[value] :
    print(f"The letter {l} has been pressed ;)")
Posted by: Guest on March-28-2021

Python Answers by Framework

Browse Popular Code Answers by Language