Reputation: 337
Is it possible to change the tqdm bar from
[Step 1]: 100%|███████████████████████████ | 109/109 [00:03<00:00, 32.46it/s]
to something like
[Step 1]: 100%[==========================> ] 109/109 [00:03<00:00, 32.46it/s]
Upvotes: 7
Views: 9568
Reputation: 356
for i in range tqdm(<iterator>, total=<>, ascii=' >='):
<your code here>
This should do the trick, the ascii argument, reads the first character is the fill character, that is space here, you can use some other character like ascii="░▒█" and the bar would look like
0%[░░░░░░░░░░░░░░░░░░░░░]
The last character is the character which it fills when the progress bar has progressed a certain amount like
30%[███████░░░░░░░░░░░░░░]
While any character you put in between will be to fill while it is progressing, like say while it moves from 30% to 40%.
35%[███████▒░░░░░░░░░░░░░]
I hope that explains your question, you can have multiple progressing characters in the middle, like
ascii=" ▖▘▝▗▚▞█"
Try this one out, it is real fun to watch this progress, provided your console supports all the Unicode characters.
Upvotes: 21
Reputation: 14233
You can pass ascii
argument when instantiate the bar. The first char is the empty one and the second is fill char.
from tqdm import tqdm
from time import sleep
with tqdm(total=100, ascii=' =') as pbar:
for i in range(10):
sleep(0.1)
pbar.update(10)
Upvotes: 1