Pygame填充命令不起作用?

时间:2017-02-05 04:04:44

标签: python python-3.x pygame

我对python很新,我开始得到它的悬念现在我开始使用pygame并且我试图用颜色填充屏幕但是因为某些原因它不能正常工作我的代码

import pygame
pygame.init()

white = (255,255,255)
black = (0,0,0)
orange = (255,165,0)

display = pygame.display.set_mode((1280,1024))

pygame.display.set_caption('ReflectOS')

Exit = False

while not Exit:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            Exit = true

            display.fill(white)
            pygame.display.update()

        print(event)

pygame.quit()
quit()

1 个答案:

答案 0 :(得分:1)

您有错误的注释 - 只有在退出程序

时才会填满屏幕
import pygame

white = (255,255,255)
black = (0,0,0)
orange = (255,165,0)


pygame.init()
display = pygame.display.set_mode((1280,1024))
pygame.display.set_caption('ReflectOS')

exit = False

while not exit:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            exit = True
        print(event)

    display.fill(white)
    pygame.display.update()

pygame.quit()
quit()