Pygame 帮助 - 新手遇到麻烦
Pygame Help- Newbie In Trouble
对 python/pygame 很陌生,正在观看 YT 上的一些教程。 https://www.youtube.com/watch?v=P8bx4nits-o <--- 特别是这个问题,我遇到了一个问题。我试图像视频中那样制作白色背景,但我做不到。不知道哪里错了
import pygame
pygame.init()
gameDisplay = pygame.display.set_mode((800, 600))
pygame.display.set_caption('slither')
white = (255, 255, 255)
gameExit = False
while not gameExit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameExit = True
gameDisplay.fill(white)
pygame.display.update()
pygame.quit()
quit()
[IMG]http://i66.tinypic.com/20swspu.png[/IMG]
如果你能帮助我,我将不胜感激!
谢谢!
您需要缩进才能将 fill
和 update
放入 while
循环中。
while not gameExit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameExit = True
gameDisplay.fill(white) # indentation
pygame.display.update() # indentation
对 python/pygame 很陌生,正在观看 YT 上的一些教程。 https://www.youtube.com/watch?v=P8bx4nits-o <--- 特别是这个问题,我遇到了一个问题。我试图像视频中那样制作白色背景,但我做不到。不知道哪里错了
import pygame
pygame.init()
gameDisplay = pygame.display.set_mode((800, 600))
pygame.display.set_caption('slither')
white = (255, 255, 255)
gameExit = False
while not gameExit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameExit = True
gameDisplay.fill(white)
pygame.display.update()
pygame.quit()
quit()
[IMG]http://i66.tinypic.com/20swspu.png[/IMG]
如果你能帮助我,我将不胜感激! 谢谢!
您需要缩进才能将 fill
和 update
放入 while
循环中。
while not gameExit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameExit = True
gameDisplay.fill(white) # indentation
pygame.display.update() # indentation