title: Exiting pygame window on click
body: <p>Making my first post here (or frankly any forum), but I was wondering why I can't exit on when the window's exit button [x] has been pressed. I have tried:</p>
  
  <pre><code>#print "Exit value ", pygame.QUIT
  for et in pygame.event.get():
      #print "Event type ", et.type
      if et.type == pygame.KEYDOWN:
              if (et.key == pygame.K_ESCAPE) or (et.type == pygame.QUIT):
                      print "In Here"
                      return True;
  pygame.event.pump()# not quite sure why we do this
  return False;
  </code></pre>
  
  <p>I've found out pygame.QUIT prints a value of 12, as I run the program an event type prints '12' when I click the [x]. The "In here" string never print on these occasions. The program exits properly when the return is true (when I press ESC on keyboard). I've looked at a few related issues: So </p>
  
  <p>I'm not running on IDLE, I'm running it on:</p>
  
  <p>Eclipse Juno Service Release 1.<br>
  Python 2.7.3 with the latest version of pygame for 2.7 (as of 3/4/13).<br>
  Windows 7 &amp; 8 and Ubuntu 12.04LTS (same result besides the no soundcard error in Ubuntu)</p>
  
  <p>I have run in Windows 7 by double clicking the .py file that runs the program and still does not exit on [x]. Thanks in advance.</p>