# Homework 31 solution, problem 3: two fills. # Run with: python exercises/31/homework/solutions/03-two-fills.py import pygame pygame.init() screen = pygame.display.set_mode((800, 600)) pygame.display.set_caption("Two Fills") clock = pygame.time.Clock() running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False screen.fill((255, 0, 0)) # paint red... screen.fill((0, 0, 255)) # ...then overwrite with blue # Result: the window is blue. # The red fill is never shown because flip() has not been called yet. # The second fill replaces every pixel the first fill set. pygame.display.flip() clock.tick(60) pygame.quit()