Bootstrap

Pygame只能检测ESC键;数字,字母无法检测怎么办

这是一个我正在编写的游戏:

"""
    Pie game
"""
import pygame
from pygame.locals import *
import sys
import math

pygame.init()
screen = pygame.display.set_mode((600, 500))
my_font = pygame.font.Font(None, 60)
pygame.display.set_caption("The Pie game---press 1/2/3/4")
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:
            sys.exit()
        elif event.type == KEYDOWN:
            print(event.key)
            print(K_1)
            if event.key == K_1:
                piece1 = True
                print("p")
            if event.key == K_ESCAPE:
                sys.exit()
            if event.key == K_2:
                piece2 = True
            if event.key == K_3:
                piece3 = True
            if event.key == K_4:
                piece4 = True
    # Clear the screen
    screen.fill((0, 0, 200))
    # Draw four numbers
    Text_Image1 = my_font.render("1", True, color)
    Text_Image2 = my_font.render("2", True, color)
    Text_Image3 = my_font.render("3", True, color)
    Text_Image4 = my_font.render("4", True, color)
    screen.blit(Text_Image1, (x + radius / 2 - 200, y - radius / 2))
    screen.blit(Text_Image2, (x + radius / 2, y - radius / 2))
    screen.blit(Text_Image3, (x + radius / 2, y - radius / 2 + 160))
    screen.blit(Text_Image4, (x + radius / 2 - 200, y - radius / 2 + 160))
    if piece1:
        start_angle = math.radians(270)
        end_angle = math.radians(0)
        pygame.draw.arc(screen, color, position, start_angle, end_angle, width)
        pygame.draw.line(screen, color, (x, y), (x, y - radius), width)
        pygame.draw.line(screen, color,(x, y), (x + radius, y),width)
    pygame.display.update()

它只能检测ESC,数字无法检测,这是为什么???

(目前作者已了解原因)

原因是输入法在英文模式下才能执行

;