Closed siddht4 closed 4 years ago
Hello @siddht4!
I'm not sure I got your doubt, but I assume you meant manual mode. That is the mode you can control the bar whatever you want.
To use it, just do:
from alive_progress import alive_bar
import time
with alive_bar(500, manual=1) as bar:
for i in range(500):
time.sleep(.01) # process
bar((i+1)/500.)
Note the bar
call. This is the place you send your percentage. The format is a float number between 0 and 1. For example to send 15%, you would send 0.15
which is 15 / 100.
as I did in the example code. The general rule is position / total
.
Was that your doubt?
@rsalmei Thank you for mentioning the above.
Can you add this to your readme/usage guide. (its partially explained,so can you also elaborate in your readme for the usage of manual mode there.
Was that your doubt?
I am obtaining the percentage through an api so I wanted to use that directly .
Looks like there is no direct usage . Can you add this mode i.e to directly provide percentage to bar
example : As how now i understand
perc_str='80.01%' #where perc_str is percentage in string format like 80.01% bar(perc_str)
No problem @siddht4
You're right, there isn't direct support the way you have. But I can't in the bar try to interpret any of infinite input formats. You should convert it to a float number before.
Using your example, you would do:
perc_str='80.01%' #where perc_str is percentage in string format like 80.01%
bar(float(perc_str[:-1]))
Hey @siddht4,
I've updated the documentation about the float argument, hope it is clearer now.
I liked your viz project for progress bar. But I am confused as your examples show int iteration to progress bar using a dummy data.
I would like to know that how i can directly provide percentage to progress bar as it generates the bar for me.
example
` a='0%'
percentage 0 to 100 %
a= '100%'
now how
ashould be passed to
alive_bar `