展开全部
亲,注意缩进32313133353236313431303231363533e78988e69d8331333361323539啊。(坑爹python缩进语言规则好讨厌~)
#修复代码
import math
import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((600,500))
pygame.display.set_caption("The Pie Game - Press 1,2,3,4")
myfont = pygame.font.Font(None, 60)
color = 200, 80, 60
width = 4
x = 300
y = 250
radius = 200
position = x-radius, y-radius, radius*2, radius*2
piece1 = False
piece2 = False
piece3 = False
piece4 = False
while True:
for event in pygame.event.get():
if event.type == QUIT:
exit()
elif event.type == KEYUP:
if event.key == pygame.K_ESCAPE:
sys.exit()
elif event.key == pygame.K_1:
piece1 = True
elif event.key == pygame.K_2:
piece2 = True
elif event.key == pygame.K_3:
piece3 = True
elif event.key == pygame.K_4:
piece4 = True
#clear the screen
screen.fill((0,0,200))
你的event.key == pygame.K_1这句写到event.type == KEYUP这句的作用域外面了。当然监测不到key了。