好吧,我很高兴在pygame上开始学习python,但是当我在学习一些入门教程的时候,我注意到,在运行代码的时候,pygame窗口看不到响应,所以我放了一些“print”命令来查看它有多远,我注意到它在循环中停止了,有什么办法可以修复它吗?我把密码留在这里
import pygame
pygame.init()
print("First Fase")
win = pygame.display.set_mode((500,500))
pygame.display.set_caption("Test")
print("Second Fase")
x = 50
y =50
width = 40
height = 60
vel = 7
print("Third Fase")
done = False
while not done:
pygame.time.delay(100)
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
if event.type == KEYDOWN:
if event.key == K_ESC:
done = True
pygame.draw.rect(win, (255, 0, 0), (x, y, width, height))
pygame.display.update()
print("NoErrors")