When I run this code, only pressing the 'a' key doesn't work. I'm not sure what I did wrong and I can't find out why it won't work.
import pygame, sys
from pygame.locals import QUIT
pygame.init()
DISPLAYSURF = pygame.display.set_mode((400, 300))
pygame.display.set_caption('Hello World!')
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_a:
a_down = True
else:
a_down = False
if a_down == True:
print("Held down 'a'")
pygame.display.update()