title: How do I get Pygame 1.9.2 to work with Python 3.3?
body: <p>I just installed Pygame 1.9.2 and am running Python 3.3. I'm having trouble figuring out how to make it so that when I click the 'X' in my pygame window, the program closes. I believe the following code works with Pygame 1.9.2 and Python 3.2, but is there any way to get it to work on Python 3.3? And what do I have to change to get the right effect? Here is some simple code that illustrates what I mean:</p>
  
  <pre><code># Drawing Lines
  
  import pygame
  from pygame.locals import *
  pygame.init()
  screen = pygame.display.set_mode((600,500))
  pygame.display.set_caption("Drawing Lines")
  
  while True:
      for event in pygame.event.get():
          if event.type in (QUIT, KEYDOWN):
              sys.exit()
  
      screen.fill((0,0,200))
  
      #draw the line
      color = 255,255,0
      width = 8
      pygame.draw.line(screen, color, (100,100), (500,400), width)
  
      pygame.display.update()
  </code></pre>
  
  <p>When I run this, a screen appears with a diagonal line on it, just like it's supposed to, but when I click the 'X' in the top-right corner of the window to close the window, I get the following error message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Python33\Exercise Programs\test_code\code\chap02\DrawingLines.py", line 13, in &lt;module&gt;
      sys.exit()
  NameError: name 'sys' is not defined
  </code></pre>
  
  <p>I guess the line that says sys.exit() is supposed to close the window if this is run in mython 3.2, but it isn't doing this in Python 3.3. The window just freezes and I get that error message. How do I achieve the desired effect in Python 3.3? What line do I need to enter?</p>