fish icon indicating copy to clipboard operation
fish copied to clipboard

example showing current record number does not work without total

Open petere opened this issue 13 years ago • 0 comments

This is based on the example in the README file:

from fish import ProgressFish
fish = ProgressFish()

churning = ['a', 'b', 'c']

def churn_churn():
    pass

for i, x in enumerate(churning):
    churn_churn()
    fish.animate(amount=i)

The output is

Traceback (most recent call last):
  File "./test.py", line 12, in <module>
    fish.animate(amount=i)
  File ".../tmp/fish/fish.py", line 166, in animate
    return super(ProgressableFishBase, self).animate(*args, **kwds)
  File ".../tmp/fish/fish.py", line 91, in animate
    step = self.worldstep.next()
  File ".../tmp/fish/fish.py", line 259, in worldstep_progressive
    part = self.amount / float(self.total)
TypeError: float() argument must be a string or a number

If I add a total to the ProgressFish creation, then it works.

petere avatar Oct 17 '12 20:10 petere