简体   繁体   中英

making multiple progress bar in python by using tqdm

I want to make 3 progress bar with tqdm library in python.
There's three progress bar and I will call it A,B,C.
After progress bar C finished, progress bar B is updated and 'reset' progress bar C, not making new progress bar.
After progress bar B finished, progress bar A is updated and reset progress bar B.
So I want to handle only 3 progress bar. I made code like this, but resetting doesn't work.

from tqdm import *

bar_A = tqdm()
bar_B = tqdm()
bar_C = tqdm()

for i in range(10):
    bar_B.reset()
    for j in range(10):
        bar_C.reset()
        for k in range(10):
            bar_C.update()
        bar_B.update()
    bar_A.update()

bar_A.close()
bar_B.close()
bar_C.close()

I fixed it and it s well-known issue of tqdm in Window.

from tqdm import *
import sys

for i in tqdm(range(10), file=sys.stdout):
    for j in tqdm(range(10), leave=False, file=sys.stdout):
        for k in tqdm(range(10), leave=False, file=sys.stdout):
            pass

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM