mirror of
https://github.com/bkerler/edl.git
synced 2024-11-14 19:14:58 -05:00
Pad progress string with spaces in print_progress()
Useful to clear previous data if line's length decreases
This commit is contained in:
parent
23a86beab6
commit
c730b72532
1 changed files with 4 additions and 1 deletions
|
@ -580,7 +580,10 @@ def print_progress(iteration, total, prefix='', suffix='', decimals=1, bar_lengt
|
|||
filled_length = int(round(bar_length * iteration / float(total)))
|
||||
bar = '█' * filled_length + '-' * (bar_length - filled_length)
|
||||
|
||||
sys.stdout.write('\r%s |%s| %s%s %s' % (prefix, bar, percents, '%', suffix))
|
||||
progstring = '\r%s |%s| %s%s %s' % (prefix, bar, percents, '%', suffix)
|
||||
cols, _ = shutil.get_terminal_size()
|
||||
progstring += " " * (cols - len(progstring) - 1)
|
||||
sys.stdout.write(progstring)
|
||||
|
||||
if iteration == total:
|
||||
sys.stdout.write('\n')
|
||||
|
|
Loading…
Reference in a new issue