1

I try to add some information in my progress bar,

This is an example of my code for the moment :

import time  
import concurrent.futures
from tqdm import tqdm

def f(x):
    time.sleep(0.001)  # to visualize the progress
    return x**2

def run(f, my_iter):
    with concurrent.futures.ThreadPoolExecutor() as executor:
        results = list(tqdm(executor.map(f, my_iter), total=len(my_iter)))
    return results

my_iter = range(100000)
run(f, my_iter)

But, I would like to add some information. Like set_description and change color. I find this code, to add .set_description :

from tqdm import trange
from time import sleep
t = trange(100, desc='Bar desc', leave=True)
for i in t:
    t.set_description("Bar desc (file %i)" % i)
    t.refresh() # to show immediately the update
    sleep(0.01)

source: Can I add message to the tqdm progressbar?

I don't know if it's possible to customize a Tqdm with ThreadPoolExecutor

Thank you,

Flo Cp
  • 281
  • 2
  • 13
  • Does this answer your question? [Use tqdm with concurrent.futures?](https://stackoverflow.com/questions/51601756/use-tqdm-with-concurrent-futures) – Demitri Aug 20 '21 at 02:18

0 Answers0