Answers for "pygame w key event"

3

pygame keydown

for event in pygame.event.get():
	if event.type == pygame.KEYDOWN:
    	return True
Posted by: Guest on June-19-2020
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