pygame onkeypress code example
Example: 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 ;)")