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

Skip to content

Commit 84ad4e5

Browse files
authored
Merge pull request #26774 from anntzer/eacc
Connect the Animation event source callback in the constructor.
2 parents 7ae83ed + 762403f commit 84ad4e5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/matplotlib/animation.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ def __init__(self, fig, event_source=None, blit=False):
891891
# that cause the frame sequence to be iterated.
892892
self.frame_seq = self.new_frame_seq()
893893
self.event_source = event_source
894+
self.event_source.add_callback(self._step)
894895

895896
# Instead of starting the event source now, we connect to the figure's
896897
# draw_event, so that we only start once the figure has been drawn.
@@ -923,13 +924,9 @@ def _start(self, *args):
923924
return
924925
# First disconnect our draw event handler
925926
self._fig.canvas.mpl_disconnect(self._first_draw_id)
926-
927927
# Now do any initial draw
928928
self._init_draw()
929-
930-
# Add our callback for stepping the animation and
931-
# actually start the event_source.
932-
self.event_source.add_callback(self._step)
929+
# Actually start the event_source.
933930
self.event_source.start()
934931

935932
def _stop(self, *args):

0 commit comments

Comments
 (0)