I have three progress bars in my code(1 main progress bar and 2 sub progress bars). I need to display those progress bars one by one in a new line.
I have tried including the new line inside the function but that is creating a new line for every iteration which will not look good.
#Progress Bar
def progress(count, total, status=''):
bar_len = 40
filled_len = int(round(bar_len * count / float(total)))
percents = round(100.0 * count / float(total), 1)
bar = '=' * filled_len + '-' * (bar_len - filled_len)
sys.stdout.flush()
sys.stdout.write('\r[%s] %s%s - %s\r' % (bar, percents, '%', status))
sys.stdout.flush()
sys.stdout.write("\r")
def sub_progress_source(count, total, status=''):
bar_len = 40
filled_len = int(round(bar_len * count / float(total)))
percents = round(100.0 * count / float(total), 1)
bar = '=' * filled_len + '-' * (bar_len - filled_len)
sys.stdout.flush()
sys.stdout.write('\r\n\t[%s] %s%s - %s\r' % (bar, percents, '%', status))
sys.stdout.flush()
sys.stdout.write("\r")
def sub_progress_target(count, total, status=''):
bar_len = 40
filled_len = int(round(bar_len * count / float(total)))
percents = round(100.0 * count / float(total), 1)
bar = '=' * filled_len + '-' * (bar_len - filled_len)
sys.stdout.flush()
sys.stdout.write('\r\n\t[%s] %s%s - %s\r' % (bar, percents, '%', status))
sys.stdout.flush()
sys.stdout.write("\r")
[====------](Main Progress Bar)
[====-----](Sub Progress Bar 1)
[=======--](Sub Progress Bar 2)