title: pygame crash right after taking an action
body: <p>Im new at Python, so the problem at my code is probably a silly one.
  Right after the image of the player is moving, the window of the pygame is crashing without an error message at the IDLE.</p>
  
  <p>im using Python 2.7.
  Here's the code: </p>
  
  <pre><code>import pygame,sys
  from pygame.locals import *
  
  pygame.init()
  dis=pygame.display.set_mode((1084,638),0,32)
  pygame.display.set_caption('ledders and snakes')
  
  FPS=30
  fpsClock=pygame.time.Clock()
  White=(255,255,255)
  img=pygame.image.load('smal.gif')
  bg = pygame.image.load("under.gif")
  
  cax=150
  cay=150
  di='right'
  flag=True
  
  while flag:
      dis.blit(bg, (0, 0))
      if di=='right':
          cax+=10
          cay-=10
          if cax==280:
              di='down'
      elif di=='down':
          cay+=10
          cax+=10
          if cax==410:
              flag=False
  
  
      dis.blit(img,(cax,cay))
  
      for event in pygame.event.get():
          if event.type==QUIT:
              pygame.quit()
              sys.exit()
  
      pygame.display.update()
      fpsClock.tick(FPS)
  </code></pre>