8000 FIX: Animation shouldn't start by itself after resizing window · matplotlib/matplotlib@d0d5bd1 · GitHub
[go: up one dir, main page]

Skip to content

Commit d0d5bd1

Browse files
FIX: Animation shouldn't start by itself after resizing window
If event_source was stopped, it should remain stopped after resize event
1 parent fbfa28d commit d0d5bd1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/animation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,7 @@ def _on_resize(self, event):
12151215
# we're paused. Reset the cache and re-init. Set up an event handler
12161216
# to catch once the draw has actually taken place.
12171217
self._fig.canvas.mpl_disconnect(self._resize_id)
1218+
self._was_stopped = self.event_source._timer is None
12181219
self.event_source.stop()
12191220
self._blit_cache.clear()
12201221
self._init_draw()
@@ -1225,7 +1226,8 @@ def _end_redraw(self, event):
12251226
# Now that the redraw has happened, do the post draw flushing and
12261227
# blit handling. Then re-enable all of the original events.
12271228
self._post_draw(None, False)
1228-
self.event_source.start()
1229+
if not self._was_stopped:
1230+
self.event_source.start()
12291231
self._fig.canvas.mpl_disconnect(self._resize_id)
12301232
self._resize_id = self._fig.canvas.mpl_connect('resize_event',
12311233
self._on_resize)

0 commit comments

Comments
 (0)
0