Using multiple bars
Try using the position
parameter when initialising the bars:
pbar1 = tqdm(total=100, position=1)
pbar2 = tqdm(total=200, position=0)
From the tqdm GitHub page:
position : int, optional
Specify the line offset to print this bar (starting from 0) Automatic if unspecified. Useful to manage multiple bars at once (eg, from threads).
Here I have some examples of nested progress bar, examples of tqdm
and some issues I have with it in general; from which I highlight the following code snippet that yields to two nice nested progress bars.
def test48():
with tqdm.notebook.trange(3, position=0, desc='Outter') as outter_range:
for i in outter_range:
leave = i == len(outter_range) - 1
for _ in tqdm.notebook.trange(3, position=1, leave=leave, desc='Inner'):
sleep(.3)