pygame fill code example

Example 1: .fill pygame

while running:
    event = pygame.event.poll()
    if event.type == pygame.QUIT:
        running=0
    screen.fill((0,0,255))
    pygame.display.flip()

Example 2: pygame surface

size = width, height = (32, 32)
empty_surface = pygame.Surface(size)

Example 3: pygame surface

# load an image as a surface
my_image = pygame.image.load(path_to_image)

Example 4: pygame surface

# blitting a surface into another surface
screen.blit(my_image, (0, 0))
pygame.display.update()  # or pygame.display.flip()