How to use Python TQDM Progress bar in Dynamo?

Hi,
During my research on Python Progress Bar implementation methods, I found a very cool library called TQDM on python. I’m not sure if my question here is relevant or not, but I imagine that there’s some possible way to be able to call this library on Dynamo with a python node, but I don’t know how to do it. So my question is, is it possible to do so and How?

Hello
Dynamo is not a console application, so I think it’s not possible to use TQDM library.

here are 2 alternatives

4 Likes

Hi Cyril,

Thanks for these links - I have successfully implemented your solution to show a generic increment progress bar based on the lst processing.

What I was wondering is how you would increment the progress bar based on the progress of a Dynamo script written with nodes rather than the len of the range or any process included in the same Python script?

#some operations with long duration
#
#
# increment Progress Bar via EventHook

Cheers

Hi @haganjake2

I have never tried, but my first idea would be to subscribe to this event from DynamoModel

2 Likes

Hi @c.poupin ,
Just digging this up again as I have a script which is doing quite a lot and it would be great to have some sort of visual indicator for users so that they know it is still thinking and not just frozen.

My first thought was to try to invoke the ‘EnableMarqueeProgressBar’ Property for a task dialogue event.

While I can display this easily, I don’t think it is going to be possible to invoke it when the script begins and then dismiss it when it reaches a conclusion…?

The only way I could think is to specify a self-destruct datetime-based while loop. But without knowing how long the process is going to take every time I don’t think this will work.

Any ideas?

The other way I was thinking is with the link you sent above with the OnNodeExecutionEnd method. Only thing is that I do not know how to implement this withing a python environment (if it is at all possible?).

Any help on the above appreciated. This might warrant a new post…

I think it’s not possible because Task dialogs (with EnableMarqueeProgressBar) are a type of modal dialog, which pauses execution

1 Like

Hi @haganjake2

Not sure if this would entirely help but you can use pyRevit for this using the following method:

from pyrevit import forms
count = 1
with forms.ProgressBar(title='my command progress message') as pb:
   # do stuff
   pb.update_progress(count, 100)
   count += 1

pyrevit.forms — pyRevit 4.8.11.22151+0454 documentation link to other form methods.
Hope this helps