1from tqdm import tdqm
2
3LENGTH = 10 # Number of iterations required to fill pbar
4
5pbar = tqdm(total=LENGTH) # Init pbar
6for i in range(LENGTH):
7 pbar.update(n=1) # Increments counter
1from tqdm import tqdm, trange
2
3with tqdm(total = 100) as progressbar:
4 for i in range(10):
5 # Here your function to calculation
6 progressbar.update(10)
1import time
2from console_progressbar import ProgressBar
3
4pb = ProgressBar(total=100,prefix='Here', suffix='Now', decimals=3, length=50, fill='X', zfill='-')
5pb.print_progress_bar(2)
6time.sleep(5)
7pb.print_progress_bar(25)
8time.sleep(5)
9pb.print_progress_bar(50)
10time.sleep(5)
11pb.print_progress_bar(95)
12time.sleep(5)
13pb.print_progress_bar(100)
14
1from time import sleep
2from tqdm import tqdm
3for i in tqdm(range(10)):
4 sleep(3)
5
6 60%|██████ | 6/10 [00:18<00:12, 0.33 it/s]
7
1import sys
2import time
3
4def progressBar(length, totalTime):
5 t = totalTime / length
6
7 sys.stdout.write("[{}]".format(" " * length))
8 sys.stdout.write("\b" * (length + 1))
9 sys.stdout.flush()
10
11 for i in range(length):
12 sys.stdout.write("-")
13 sys.stdout.flush()
14 time.sleep(t)
15
16progressBar(30, 2) # first value = the length of the progress bar
17 # second value = the total of time to fill the progress bar
18
19# Code by Yoann Bertel