-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested Trees? #384
Comments
you could make things tree-like... from tqdm import trange
from time import sleep
for i in trange(9, desc=' '):
for j in trange(i, desc=' ' * 5):
for k in trange(j, desc=' ' * 9):
sleep(0.1)
print('\n')
|
If I'm not mistaken, while that displays as a tree, it only really allows you to advance the inner most progress bar doesn't it? One of the goals here is to have the inner most bars operate entirely independently of each other and they can be progressing in parallel (in say worker threads or something). |
See #329, #285... from tqdm import tqdm, trange
from time import sleep
a1 = tqdm(total=2, desc="a1", position=0)
b1 = tqdm(total=2, desc=" b1", position=1)
c1 = trange(9, desc=" c1", position=2)
c2 = trange(9, desc=" c2", position=3)
b2 = trange(9, desc=" b2", position=4)
def do(inner, outer):
for i in inner:
sleep(0.1)
outer.update()
def do_b1():
do(c1, b1)
do(c2, b1)
a1.update()
def do_b2():
for i in b2:
sleep(0.1)
a1.update()
def do_a1():
do_b1()
do_b2()
do_a1()
print('\n' * 3) a1: 100%|█████████████████████████████████████████| 2/2 [00:02<00:00, 1.54s/it]
b1: 100%|███████████████████████████████████████| 2/2 [00:01<00:00, 1.10it/s]
c1: 100%|█████████████████████████████████████| 9/9 [00:00<00:00, 9.96it/s]
c2: 100%|█████████████████████████████████████| 9/9 [00:01<00:00, 6.55it/s]
b2: 100%|███████████████████████████████████████| 9/9 [00:02<00:00, 4.88it/s] Note you might need #385 to get this working properly. Writing this minimal example definitely helped me find this bug. Thanks @dstufft. @lrq3000 please review #385 as I think it may fix a few related issues, but possibly cause some too. |
closing as assumed solved. Happy to re-open if there are any more suggestions. |
I see how to handle nested progress bars, but I wonder if it's possible to have nested trees? If not is that something you could see yourself adding? This is sort of like what was asked in #312 except you want the ability to have multiple progress bars going at once.
You can see an example of this at https://github.com/hfaran/progressive/.
The text was updated successfully, but these errors were encountered: