import pygame from pygame.locals import * import sys pygame.init() while 1 : pressed_keys = pygame.key.get_pressed() if pressed_keys[K_a]: print("Key A has been pressed")