Still learning tqdm, is there a way to make a progress bar and update within a helper function?
I have checked out other questions, but I couldn't find the answer, like How to "flush" tqdm progress bar explicitly?
What I have also tried:
from tqdm import tqdm
import time
def helper_function(progress, outer_total):
for i in range(100):
# do some work
time.sleep(1)
progress.update(1/outer_total/100)
return
def main_function():
with tqdm(total=1000, desc="Main loop", unit="iter") as progress:
for j in range(10):
# do some work
time.sleep(1)
helper_function(progress, 1000)
main_function()
> Main loop: 0%| | 0.00999999999999976/1000 [00:00<01:37, 10.22iter/s]
Not really what I wanted.
- Somehow it's stuck at infinite loop and always 0%
- I pretty much just want
%
, how do I remove the other things on the progress bar?
Any help would be great.