title: Using a background image in pygame window
body: <p>I've got a simple python file which opens up a <code>pygame</code> window. When I click and release within the window, the program will tell me where my cursor was when I started clicking and where I released it. How do I include code to have a background image in the <code>pygame</code> window? So far, I only how to do this programs as stand-alone.</p>
  
  <pre><code>import pygame, sys
  
  LEFT = 1
  
  running = True
  screen = pygame.display.set_mode((1200, 1000))
  
  
  while running:
   screen.fill((0,0,0))
   pygame.display.flip()
   event = pygame.event.poll()
   if event.type == pygame.QUIT:
       running = False
       pygame.quit()
  
   elif event.type == pygame.MOUSEBUTTONDOWN and event.button == LEFT:
       print ("You pressed the left mouse button at (%d, %d)" % event.pos)
   elif event.type == pygame.MOUSEBUTTONUP and event.button == LEFT:
       print ("You released the left mouse button at (%d, %d)" % event.pos)
  </code></pre>