Not sure if this was intentional or an oversight, but there doesn't appear to be any reason that floating point values can't be used when updating the current state of the progress bar.
78c95b649984b1610d1d4420143baeaa31252d00 added an isinstance(value, int) check at the beginning of ProgressBar.update, that should probably either throw a type error if floating points are not intended to be supported anymore, or updated to be (isinstance(value, int) or isinstance(value, float)).
Code
import time
import progressbar
widgets = ['Test ', progressbar.Bar(), ' ', progressbar.Percentage('%(percentage)6.2f%%'), ' ', progressbar.AdaptiveETA()]
with progressbar.ProgressBar(widgets=widgets, max_value=20) as bar:
for i in range(20):
bar.update(i+0.1)
time.sleep(0.5)
When running this, the bar does not update until the loop finishes. Removing the + 0.1 causes the bar to update as expected.
Description
Not sure if this was intentional or an oversight, but there doesn't appear to be any reason that floating point values can't be used when updating the current state of the progress bar.
78c95b649984b1610d1d4420143baeaa31252d00 added an
isinstance(value, int)
check at the beginning ofProgressBar.update
, that should probably either throw a type error if floating points are not intended to be supported anymore, or updated to be(isinstance(value, int) or isinstance(value, float))
.Code
When running this, the bar does not update until the loop finishes. Removing the
+ 0.1
causes the bar to update as expected.