Py学习  »  Python

python 3.2w/pygame崩溃

Lutmer • 5 年前 • 473 次点击  

好吧,我很高兴在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")
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/42977
 
473 次点击  
文章 [ 1 ]  |  最新文章 5 年前