Q: Nested for loop is not working the way I wanted I am using a nested for loop to make a color gradually change in pygame. My problem is that the change only happens to the blue color. Why???? here is the code:
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)

the for loop only applies on 'a'

A: You can see what happens by printing out the values of a, b and c during the loop:
for a in range(256):
    for b in range(256):
        for c in range(256):
            print(a, b, c)

This will give the result of c (blue) first a going from 0 to 255, and then b increasing to 1, and c jumping back to 0, and then increasing to 255 again, and then b becoming 2, and c going from 0 to 255 again.
I suspect you just aren't giving the program the time to affect green before you kill it. And since it needs 65536 re-paintings to even start to affect red, that will take quite some time.
The question is what kind of effect you actually were aiming for.
