title: Pause system in pygame
body: <p>hi there i've spent hours trying to make a toggle pause in pygame that you press space and it pauses then you press space again to un-pause and i'm having no luck would any one be able to help me please?</p>
  
  <pre><code>  ############### 2nd attempt ############# 
   global timedelay
  
          timedelay = pygame.time.wait (0)
          pause = 0
  
          if event.type == KEYUP:
              if event.key == K_p  and pause == 0:
                  timedelay = pygame.time.wait (9999)
                  pause = 1
                  if event.key == K_p  and pause == 0:
                      timedelay = pygame.time.wait (0)
                      pause = 0
          timedelay
  
  
          ############### 1st attempt #############       
          if event.type == KEYDOWN:   
              pause = 0
              if event.key == K_p and pause == 0:
                  while 1: 
                      pause = 0
                      event = pygame.event.wait()
                      pause = 1
                      if event.type == KEYDOWN:
                          if event.key == K_p  and pause == 0:
                              print "woo!"
                              pause = 0
                              break
  </code></pre>