8000 FIX: Handle stopped animation figure resize by greglucas · Pull Request #22561 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

FIX: Handle stopped animation figure resize #22561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1397,14 +1397,26 @@ def _step(self, *args):
# delay and set the callback to one which will then set the interval
# back.
still_going = super()._step(*args)
if not still_going and self.repeat:
self._init_draw()
self.frame_seq = self.new_frame_seq()
self.event_source.interval = self._repeat_delay
return True
else:
self.event_source.interval = self._interval
return still_going
if not still_going:
if self.repeat:
# Restart the draw loop
self._init_draw()
self.frame_seq = self.new_frame_seq()
self.event_source.interval = self._repeat_delay
return True
else:
# We are done with the animation. Call pause to remove
# animated flags from artists that were using blitting
self.pause()
if self._blit:
# Remove the resize callback if we were blitting
self._fig.canvas.mpl_disconnect(self._resize_id)
self._fig.canvas.mpl_disconnect(self._close_id)
self.event_source = None
return False

self.event_source.interval = self._interval
return True


class ArtistAnimation(TimedAnimation):
Expand Down
0