Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f0801e9

Browse files
committed
Don't let a StopIteration (and repeat) count as a step.
Instead, make sure that an additional _step() is called, after the loop delay if necessary.
1 parent 33e4bb0 commit f0801e9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/matplotlib/animation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,12 +586,14 @@ def _step(self, *args):
586586
# callback to one which will then set the interval back.
587587
still_going = Animation._step(self, *args)
588588
if not still_going and self.repeat:
589+
self.frame_seq = self.new_frame_seq()
589590
if self._repeat_delay:
590591
self.event_source.remove_callback(self._step)
591592
self.event_source.add_callback(self._loop_delay)
592593
self.event_source.interval = self._repeat_delay
593-
self.frame_seq = self.new_frame_seq()
594-
return True
594+
return True
595+
else:
596+
return Animation._step(self, *args)
595597
else:
596598
return still_going
597599

@@ -607,6 +609,7 @@ def _loop_delay(self, *args):
607609
self.event_source.remove_callback(self._loop_delay)
608610
self.event_source.interval = self._interval
609611
self.event_source.add_callback(self._step)
612+
Animation._step(self)
610613

611614

612615
class ArtistAnimation(TimedAnimation):

0 commit comments

Comments
 (0)