File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed
Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -1397,14 +1397,26 @@ def _step(self, *args):
13971397 # delay and set the callback to one which will then set the interval
13981398 # back.
13991399 still_going = super ()._step (* args )
1400- if not still_going and self .repeat :
1401- self ._init_draw ()
1402- self .frame_seq = self .new_frame_seq ()
1403- self .event_source .interval = self ._repeat_delay
1404- return True
1405- else :
1406- self .event_source .interval = self ._interval
1407- return still_going
1400+ if not still_going :
1401+ if self .repeat :
1402+ # Restart the draw loop
1403+ self ._init_draw ()
1404+ self .frame_seq = self .new_frame_seq ()
1405+ self .event_source .interval = self ._repeat_delay
1406+ return True
1407+ else :
1408+ # We are done with the animation. Call pause to remove
1409+ # animated flags from artists that were using blitting
1410+ self .pause ()
1411+ if self ._blit :
1412+ # Remove the resize callback if we were blitting
1413+ self ._fig .canvas .mpl_disconnect (self ._resize_id )
1414+ self ._fig .canvas .mpl_disconnect (self ._close_id )
1415+ self .event_source = None
1416+ return False
1417+
1418+ self .event_source .interval = self ._interval
1419+ return True
14081420
14091421
14101422class ArtistAnimation (TimedAnimation ):
You can’t perform that action at this time.
0 commit comments