几秒钟后(大约5秒),这段简单的代码崩溃(窗口没有响应).
import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((640, 480), 0, 24)
#clock = pygame.time.Clock()
#font = pygame.font.Font(None, 32)
cycles = 0
while True:
screen.fill(0)
# text = font.render('Cycles : %d' % cycles, True, (255, 255, 255))
# screen.blit(text, (100, 100))
cycles += 1
pygame.display.update()
如果我取消注释注释行,我可以清楚地看到程序在显示47到50之间的值时失控.
我使用python 2.7和pygame 1.9.2,Windows 8(64位)和Eclipse PyDev.
在Python 2.7和Pygame 1.9.2环境下,一个简单的游戏循环代码导致程序在运行5秒左右崩溃。当取消注释特定行后,程序在显示47到50之间的值时失去控制。问题可能与帧率控制或内存管理有关。

被折叠的 条评论
为什么被折叠?



