Problems with sys.stout.flush()
Joel Ross
joelc at cognyx.com
Sat May 23 13:19:11 EDT 2009
Thanks for all the help guys. I got it to work correctly with this
class progress:
def __init__(self):
self.already = 0
def progressbar(self, number, total, char):
percentage = int(100 - round(number*100.0/total))
if percentage > 0:
xchar = char * (percentage-self.already)
self.already = percentage
sys.stdout.write(xchar)
sys.stdout.flush()
sleep(1)
Keeping track of the characters that had already been printed solved my
main problem thanks Dave and everyone else for helping me out with this
issue. Now I can move onto next one.
jross
More information about the Python-list
mailing list