Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # console_progressbar.py
- import time, sys, os
- def clear(): os.system('cls||clear') ###ZZZ might be quite glitchy
- class ProgressBar():
- pointer = 0
- width = 50
- def __call__(self,x):
- # x in percent
- self.pointer = int(self.width*(x/100.0))
- progress = '\r > ' + chr(178)*self.pointer + ':'*(self.width-self.pointer)+\
- " < %d Percent " % int(x)
- #clear()
- sys.stdout.write(progress)
- sys.stdout.flush()
- print
- pb = ProgressBar()
- for i in range(101):
- pb(i)
- time.sleep(0.1)
- print "\n\n *** Task Now Complete ***"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement