title: Reduce flicker in python loading bar?
body: <p>Afternoon folks, I've got a loading bar in a python console app, and it flickers constantly during execution.  I managed to make it better by rearranging the print('\r') and print(bar) statements.  <code>print_progress_bar()</code> is as follows:</p>
  
  <pre><code>def print_progress_bar(percent):
      done_len = int(percent * progress_bar_length)
      bar = "["
      bar += "=" * done_len
      bar += "&gt;"
      bar += " " * (progress_bar_length - done_len)
      bar += "] "
      bar += str(round(percent*100))
      bar += "%"
      print("\r", end='')
      print(bar+(" " * 5), end='')
  </code></pre>
  
  <p>I'm using it in a filesystem analysis, but here is a simple driver to test.</p>
  
  <pre><code>import time
  
  progress_bar_length = 20
  limit = 100
  
  for i in range(1, limit):
      print_progress_bar(i/limit)
      time.sleep(0.1)
  print("Done")
  </code></pre>
  
  <p>Any way to stop the flicker?</p>