Pygame: Adding a background
<p>I'm making a project for my senior year. Its a game where i can move a user. I would like to add a background that goes behind all the pictures i've blitted. I've searched everywhere but i can't seem to find the solution. Could anybody help?</p>

<pre><code>import pygame
import os

class Player(object):  
    def __init__(self):
        self.image = pygame.image.load("player1.png")
        self.image2 = pygame.transform.flip(self.image, True, False) 
        self.coffee=pygame.image.load("coffee.png")
        self.computer=pygame.image.load("computer.png")        

        self.flipped = False
        self.x = 0
        self.y = 0


    def handle_keys(self):
        """ Movement keys """
        key = pygame.key.get_pressed()
        dist = 5
        if key[pygame.K_DOWN]: 
            self.y += dist 
        elif key[pygame.K_UP]: 
            self.y -= dist 
        if key[pygame.K_RIGHT]: 
            self.x += dist
            self.flipped = False
        elif key[pygame.K_LEFT]:
            self.x -= dist
            self.flipped = True

    def draw(self, surface):
        if self.flipped:
            image = self.image2
        else:
            image = self.image
        surface.blit(image, (self.x, self.y))
        surface.blit(self.coffee, (700,500))
        surface.blit(self.computer,(0,500))


pygame.init()

screen = pygame.display.set_mode((810, 610))    #creates the screen

player = Player() 
clock = pygame.time.Clock()

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()      # quit the screen
            running = False

    player.handle_keys()       # movement keys
    screen.fill((255,255,255)) # fill the screen with white
    player.draw(screen)        # draw the player to the screen
    pygame.display.update()    # update the screen

    clock.tick(60)             # Limits Frames Per Second to 60 or less
</code></pre>

<p>A background image is no different from any other image. Just .blit it first.</p>

python python-2.7