1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import time import sys toolbar_width = 40 # setup toolbar sys.stdout.write("[%s]" % (" " * toolbar_width)) sys.stdout.flush() sys.stdout.write("\b" * (toolbar_width+1)) # return to start of line, after '[' for i in xrange(toolbar_width): time.sleep(0.1) # do real work here # update the bar sys.stdout.write("-") sys.stdout.flush() sys.stdout.write("\n") |
![Firefox - Codehaven](https://www.codehaven.co.uk/wp-content/uploads/2018/12/Mozilla_Firefox_logo_2013-1.png)