zvyn / python-progressbar

Automatically exported from code.google.com/p/python-progressbar
Other
0 stars 0 forks source link

widget for showing progress in absolute values #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice to have widget which shows current values. 

Eg. pb=ProgressBar(maxval=1000,widgets=[ETA(),SomeWidget()]) 
...
..
pb.update(100)

shows:
01:11:00 100/1000

Original issue reported on code.google.com by lukaszm...@gmail.com on 3 Aug 2010 at 7:46

GoogleCodeExporter commented 9 years ago
in fact, it's rather feature than defect

Original comment by lukaszm...@gmail.com on 3 Aug 2010 at 7:47

GoogleCodeExporter commented 9 years ago
I added some time ago to the repository a widget named SimpleProgress which 
will display, for instance, '5 of 47'. I'll add a separator argument to the 
initializer so that you can create it as SimpleProgress(sep='/') and get 
'5/47'. I'll then do a new release.

Original comment by nilton.v...@gmail.com on 4 Aug 2010 at 3:01

GoogleCodeExporter commented 9 years ago
I've updated the code with the change to SimpleProgress that I described. 
There's also a new feature, which makes it possible to use the progressbar as 
an iterator. See examples 7 and 8 in 
http://code.google.com/p/python-progressbar/source/browse/progressbar/examples.p
y.

So, you can use it like:

pb = ProgressBar(maxval=1000, widgets=[ETA(), SimpleProgress(sep='/')])
for i in pb(my_iterable):
  # do something

You can try it from release 2.3-dev. I'll see if I can fix issue 3 before 
actually releasing version 2.3. It would be great if you could try and tell me 
if it worked for you.

Thanks.

Original comment by nilton.v...@gmail.com on 29 Aug 2010 at 11:01