Issue
I have tried the following methods
- Set leave=False or disable=True
- tqdm_iterator.close()
but they cannot remove the broken progress bar.
from tqdm.notebook import tqdm
tqdm_iterator = tqdm(range(10000), leave=False)
for i in tqdm_iterator:
time.sleep(0.0001)
if i>8000:
tqdm_iterator.n = 10000
break
Solution
The leave=False
parameter only removes the display bar after it finishes, ex. when the counter reaches 10000
. If you want to clear the progress bar output immediately, you can do tqdm_iterator.container.close()
, like this:
from tqdm.notebook import tqdm
tqdm_iterator = tqdm(range(10000), leave=False)
for i in tqdm_iterator:
time.sleep(0.0001)
if i > 8000:
tqdm_iterator.container.close()
break
Answered By - David
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.