This is easy way to create and show the progress bar in terminal using Python. This is useful for installation or loading a page. The module is called tqdm and it eases your mind with a small progress bar to show an estimation of a process.
Installation
$ pip install tqdm
Usage (in Python)
A simple example for testing
from tqdm import tqdm
for i in tqdm(range(int(9e6))):
pass
Use a parameter to specify the description of progress bar.
from tqdm import tqdm
from time import sleep
for i in tqdm(range(0, 100), desc ="Loading"):
sleep(.1)
To specify the total number of expected iterations.
from tqdm import tqdm
from time import sleep
for i in tqdm(range(0, 100), total = 500,desc ="Loading"):
sleep(.1)
To specify the entire width.
from tqdm import tqdm
from time import sleep
for i in tqdm(range(0, 100), ncols = 100,desc ="Loading"):
sleep(.1)
To specify the minimum progress display update (default is 0.1 seconds).
from tqdm import tqdm
from time import sleep
for i in tqdm(range(0, 100), mininterval = 3, desc ="Loading"):
sleep(.1)
To fill the progress bar with ASCII characters.
from tqdm import tqdm
from time import sleep
for i in tqdm(range(0, 100), ascii ="123456789$"):
sleep(.1)
Links:
- https://www.geeksforgeeks.org/python-how-to-make-a-terminal-progress-bar-using-tqdm/
- https://pypi.org/project/tqdm/