title: python add time to a countdown already running
body: <p>I want to have an app where if I click a button I add X amount of time to my running countdown timer.</p>
  
  <p>I'm guessing I have to use threads for this but am not sure how to implement it.. </p>
  
  <p>Here is the code I have so far:</p>
  
  <pre><code>def countdown_controller(add_time):
      end_it = False
      def timer(time_this):
          start = time.time()
          lastprinted = 0
          finish = start + time_this
          while time.time() &lt; finish:
              now = int(time.time())
              if now != lastprinted:
                  time_left = int(finish - now)
                  print time_left
                  lastprinted = now
              if end_it == True:
                  now = finish
              time.sleep(0.1)
      # Check if the counter is running otherwise just add time.
      try:
          time_left 
      except NameError:
          timer(add_time)
      else:
          if time_left == 0:
          timer(add_time)
          else:
              add_this = time_left
              end_it = True
              while now != finish:
                  time.sleep(0.1)
              timer(add_time + add_this)
  </code></pre>
  
  <p>Obviously this will not work, because every time I call <code>countdown_controller(15)</code> fx, it will start counting down for 15 seconds and if I click my button nothing happens until the timer is ended.</p>
  
  <p>Help would be greatly appreciated.</p>