NameError: name 'KEYDOWN' is not defined
问题 I am new to programming with PyGame and I've made this code: import sys, pygame pygame.init() size = width, height = 800, 600 speed = [2, 2] black = 1, 1, 1 screen = pygame.display.set_mode(size) ball = pygame.image.load("ball.bmp") ballrect = ball.get_rect() player1 = pygame.image.load("player1.png") player1rect = player1.get_rect() mod_x = mod_y = 0 while 1: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() elif event.type == KEYDOWN: if event.key == K_W: movex = 2