title: How do I exit a Python program that has a thread running?
body: <p>I'm writing some simple code and I use Pygame for graphics and I  have a thread that draws everything. When I call sys.exit() or just ctrl+c, the main program exits but the thread seems to still be alive. I think I need to shut it down before. How do I do that?</p>
  
  <p>Example:</p>
  
  <pre><code>import threading
  
  class Bla(threading.Thread):
      def run(self):
          print "I draw here"
  
  Bla().start()
  
  while True:
       if user_wants_to_end:
           sys.exit()
  </code></pre>
  
  <p>And when I do want to exit the program doesn't exit! How do I shut the thread down?</p>