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
1import time
2import sys
3
4done = 'false'
5#here is the animation
6def animate():
7 while done == 'false':
8 sys.stdout.write('\rloading |')
9 time.sleep(0.1)
10 sys.stdout.write('\rloading /')
11 time.sleep(0.1)
12 sys.stdout.write('\rloading -')
13 time.sleep(0.1)
14 sys.stdout.write('\rloading \\')
15 time.sleep(0.1)
16 sys.stdout.write('\rDone! ')
17
18animate()
19#long process here
20done = 'false'
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
1import time
2import sys
3
4toolbar_width = 40
5
6# setup toolbar
7sys.stdout.write("[%s]" % (" " * toolbar_width))
8sys.stdout.flush()
9sys.stdout.write("\b" * (toolbar_width+1)) # return to start of line, after '['
10
11for i in xrange(toolbar_width):
12 time.sleep(0.1) # do real work here
13 # update the bar
14 sys.stdout.write("-")
15 sys.stdout.flush()
16
17sys.stdout.write("]\n") # this ends the progress bar
18