title: Print with multithreads in one line
body: <p>I want to print in one line with multithreads. I created a class which creates a new thread to print it:</p>
  
  <pre><code>class Printer(threading.Thread):
      def __init__(self, count1, count2):
          threading.Thread.__init__(self)
          self.count1 = count1
          self.count1 = count1
  
      def run(self):
          while True:
              to_print = '\rCount1: {}      Count2: {}'.format(self.count1, self.count1)
              sys.stdout.write(to_print)
              sys.stdout.flush()
              time.sleep(5)
  </code></pre>
  
  <p>Then I run it via:</p>
  
  <pre><code>class ThreadPool(object): 
      def __init__(self,args):
  
      for _ in range(num_threads):
          worker = Worker(self.__queue) #Worker is a class run some tasks.
          if False is worker.isAlive():
              worker.setDaemon(True)
              worker.start()
  
      s = ThreadWriterSuccess(self.__write_q, 'success.txt')
      s.setDaemon(True)
      s.start()
  
      f = ThreadWriterFailed(self.__failed_q, 'failed.txt')
      f.setDaemon(True)
      f.start()
  
      p = Printer(s.counter, f.counter)
      p.setDaemon(True)
      p.start()
  
  class ThreadWriterSuccess(threading.Thread):
      "Write Success"
  
      def __init__(self, queue, outputPath):
          self.q = queue
          self.outputPath = outputPath
          threading.Thread.__init__(self)
          self.counter = 0
  
      def run(self):
          """
          Write data in queue to file
          :return: None
          """
          while True:
              toWrite = self.q.qsize()
              self.counter += toWrite
              outputFile = open(self.outputPath, 'a+')
              for i in range(toWrite):
                  data = self.q.get()
                  content = 'SUCCESS | {0}\n'.format(data)
                  outputFile.write(content)
                  self.q.task_done()
              outputFile.close()
              time.sleep(10)
  
  
  class ThreadWriterFailed(threading.Thread):
      "Write failed"
  
      def __init__(self, queue, outputPath):
          self.q = queue
          self.outputPath = outputPath
          threading.Thread.__init__(self)
          self.counter = 0
  
      def run(self):
          """
          Write data in queue to file
          :return: None
          """
          while True:
              toWrite = self.q.qsize()
              self.counter += toWrite
              # print('Die: {}'.format(self.counter), end='\r')
              outputFile = open(self.outputPath, 'a+')
              for i in range(toWrite):
                  data = self.q.get()
                  content = 'FALSE: | {0}\n'.format(data)
                  outputFile.write(content)
                  self.q.task_done()
              outputFile.close()
              time.sleep(5)
  </code></pre>
  
  <p>Note: <code>s.counter</code> and <code>f.counter</code> is a value in the <code>ThreadWriterSuccess</code> and <code>ThreadWriterFailed</code> classes.</p>
  
  <p>However, when I run a program, the Printer class only runs and prints in the first time. It is not running again. How I can fix this? Thanks.</p>