0
我使用嵌套循环使pygame中的颜色逐渐变化。我的问题是,改变只发生在蓝色。为什么????这里是代码:嵌套for循环不按我想要的方式工作
while True:
for a in range(256):
for b in range(256):
for c in range(256):
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
text = basicFont.render('Hello world!', True, (a, b, c), black)
textRect = text.get_rect()
textRect.centerx = windowSurface.get_rect().centerx
textRect.centery = windowSurface.get_rect().centery
windowSurface.fill(black)
windowSurface.blit(text, textRect)
pygame.display.update()
mainClock.tick(40)
你可能会考虑格式化你的代码,以便人们可以阅读它。 – 2012-02-16 01:42:41
也许你混合了制表和空格。这让Python感到困惑。 – Maciek 2012-02-16 07:43:37
有什么办法可以让它正常工作? – 2012-02-16 22:53:51