title: How to use threading to get user input realtime while main still running in python
body: <p>In the WHILE loop, I wanna run two function, one is base function, which will run everytime, the other is user_input function, when user input 'disarm', program can run user_input function.
    This two function need in WHILE loop so can run all the time.</p>
  
  <p>How could I do to write a function to accomplish this?</p>
  
  <p>Because its realtime so I cant add time.sleep in threading.</p>
  
  <p>Thanks.</p>
  
  <pre><code>import threading
  
  class BackInput(threading.Thread):
      def __init__(self):
          super(BackInput, self).__init__()
  
  
      def run(self):
          self.input = raw_input()
  
  while True:
      threading1 = BackInput()
      threading1.start()
      threading1.join()
      if threading1.input == 'disarm':
          print 'Disarm'
          break
      print 'Arm'
  </code></pre>
  
  <p>In this code, the program should print Arm every second, when I typed disarm, it can print Disarm and break it.</p>