-3
即時通訊使用pygame做一個情節(我知道我可以使用matplotlib但這適合更好),情節呈現正確,但pygame窗口掛起,是代碼有問題嗎?pygame窗口掛
xp,yp = 400,400
pantalla = pygame.display.set_mode((xp,yp))
pantalla.fill((255,255,255))
for x in range(0,xp,20):
pygame.draw.line(pantalla, (0,0,0) , (x, 1), (x, 800))
for y in range(0,yp,20):
pygame.draw.line(pantalla, (0,0,0) , (1, y), (800, y))
pygame.draw.line(pantalla,(0,0,0), (yp/2,0),(yp/2,xp),4)
pygame.draw.line(pantalla,(0,0,0), (0,xp/2),(yp,xp/2),4)
pygame.draw.circle(pantalla, (0,0,0), (xp/2,yp/2),5)
pygame.display.flip()
#### La pantalla esta cargada totalmente a partir de aqui
while 1:
colora,colorb,colorc = random.randint(0,0),random.randint(0,0),random.randint(0,0)
listacoordenadas = []
for x in range(-6,7):
listacoordenadas.append((x*20+xp/2,yp/2-eval(code)*20))
for indice in range(len(listacoordenadas)-1):
pygame.draw.line(pantalla,(colora,colorb,colorc), listacoordenadas[indice],listacoordenadas[indice+1],4)
pygame.display.flip()
raw_input()
'while 1:'並沒有明確的'break' - 你期望在那裏發生什麼? –