title: How can I close pygames without closing tkinter?
body: <p>So I am trying to use Tkinter to receive a text input, and then run pygames from that to do an animation. I get an error though when I close Pygames.</p>
  
  <p>A simplified version of how I plan to use Pygames:</p>
  
  <pre><code>def the_program():
      if spot.get().strip() == "":
          tkMessageBox.showerror("X", "Y")
      else:
          code = spot.get().strip()
          pygame.init()
          pygame.display.set_caption('X')
          windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), 0, 32)
          while True:
              for event in pygame.event.get():
                  if event.type == QUIT:
                      pygame.quit()
                      sys.exit()
              pygame.display.update()
  </code></pre>
  
  <p>Running Tkinter:</p>
  
  <pre><code>root = Tk()
  frame = Frame(root)
  text = Label(frame, text='X')
  spot = Entry(frame)
  button = Button(frame, text = 'Ready?', command = the_program) "Starts Pygames"
  frame.pack()
  text.pack()
  spot.pack()
  button.pack()
  
  root.mainloop()
  </code></pre>
  
  <p>Pygames opens up fine and runs well, but when I close it I get this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Python26\Practice\legit Battle Master.py", line 82, in &lt;module&gt;
      root.mainloop()
    File "C:\Python26\lib\lib-tk\Tkinter.py", line 1017, in mainloop
      self.tk.mainloop(n)
    File "C:\Python26\lib\lib-tk\Tkinter.py", line 1412, in __call__
      raise SystemExit, msg
  </code></pre>
  
  <p>How can I avoid this? I tried removing "sys.exit()", but python crashes. </p>