Pygame: Variable not updating each iteration
Question: I'm brand new to Python, so this is probably a simple problem. I want the code
to display "rotation: " followed by the value of the variable player_rotation.
It does this, but the value displayed does not by 1 every iteration (as I
would expect it to).

    
    
    import pygame
    from pygame.locals import *
    
    pygame.init()
    screen = pygame.display.set_mode((480, 480))
    myfont = pygame.font.SysFont("monospace", 15)
    player_rotation = 0
    rotation_label = myfont.render("rotation: " + str(player_rotation), 1, (255,255,0))
    
    while 1:
    
        screen.blit(rotation_label, (100,100))
        player_rotation += 1
        pygame.display.flip()
    
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            pygame.quit()
            exit(0)
    


Answer: You set the label only once and this occurs before the loop. Try moving
rotation_label into your loop.

    
    
    while 1:
        rotation_label = myfont.render("rotation: " + str(player_rotation), 1, (255,255,0))
        screen.blit(rotation_label, (100,100))
        player_rotation += 1
        pygame.display.flip()
    

Also, your code in `for` loop is never executed because it appears after your
`while 1`

