I'm trying to display a progress bar in a jupyter notebook with a bold description preceding the bar.
for i in tqdm(range(10), desc='\x1b[1mglobal progress'):
time.sleep(.2)
seems to produce
I tried different options, qqdm and rich seem to work, but the former is stuck to 4 years ago, the latter seems to have a little too much overhead.
Following the comments I did this:
for i in tqdm(range(10), desc=tqdm.write('\x1b[1m global progress', end="")):
time.sleep(.2)
which renders the text in bold, but introduces an unwanted newline. The end=""
argument does not seem to have any effect. Actually I have exactly the same result if I use the built-in print
function
Thanks for any help
I'm trying to display a progress bar in a jupyter notebook with a bold description preceding the bar.
for i in tqdm(range(10), desc='\x1b[1mglobal progress'):
time.sleep(.2)
seems to produce
I tried different options, qqdm and rich seem to work, but the former is stuck to 4 years ago, the latter seems to have a little too much overhead.
Following the comments I did this:
for i in tqdm(range(10), desc=tqdm.write('\x1b[1m global progress', end="")):
time.sleep(.2)
which renders the text in bold, but introduces an unwanted newline. The end=""
argument does not seem to have any effect. Actually I have exactly the same result if I use the built-in print
function
Thanks for any help
Share Improve this question edited Mar 10 at 15:35 user2078621 asked Mar 10 at 15:07 user2078621user2078621 1413 silver badges12 bronze badges 6 | Show 1 more comment2 Answers
Reset to default 0For those wanting to use this with tqdm.notebook
- the Jupyter Notebook progressbar decorator for iterators, you'll need both tqdm and ipywidgets installed, then try:
from tqdm.notebook import tqdm
import time
for i in tqdm(range(5), desc='
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744838955a4596438.html
tqdm.write
– steve-ed Commented Mar 10 at 15:10