@@ -590,9 +590,6 @@ def __init__(self, fig, event_source=None, blit=False):
590
590
self .frame_seq = self .new_frame_seq ()
591
591
self .event_source = event_source
592
592
593
- # Clear the initial frame
594
- self ._init_draw ()
595
-
596
593
# Instead of starting the event source now, we connect to the figure's
597
594
# draw_event, so that we only start once the figure has been drawn.
598
595
self ._first_draw_id = fig .canvas .mpl_connect ('draw_event' , self ._start )
@@ -609,15 +606,18 @@ def _start(self, *args):
609
606
Starts interactive animation. Adds the draw frame command to the GUI
610
607
handler, calls show to start the event loop.
611
608
'''
612
- # On start, we add our callback for stepping the animation and
613
- # actually start the event_source. We also disconnect _start
614
- # from the draw_events
615
- self .event_source .add_callback (self ._step )
616
- self ._init_draw ()
617
- self .event_source .start ()
609
+ # First disconnect our draw event handler
618
610
self ._fig .canvas .mpl_disconnect (self ._first_draw_id )
619
611
self ._first_draw_id = None # So we can check on save
620
612
613
+ # Now do any initial draw
614
+ self ._init_draw ()
615
+
616
+ # Add our callback for stepping the animation and
617
+ # actually start the event_source.
618
+ self .event_source .add_callback (self ._step )
619
+ self .event_source .start ()
620
+
621
621
def _stop (self , * args ):
622
622
# On stop we disconnect all of our events.
623
623
if self ._blit :
@@ -1041,7 +1041,7 @@ def _init_draw(self):
1041
1041
1042
1042
# Flush the needed axes
1043
1043
for fig in figs :
1044
- fig .canvas .draw ()
1044
+ fig .canvas .draw_idle ()
1045
1045
1046
1046
def _pre_draw (self , framedata , blit ):
1047
1047
'''
@@ -1156,8 +1156,9 @@ def _init_draw(self):
1156
1156
self ._draw_frame (next (self .new_frame_seq ()))
1157
1157
else :
1158
1158
self ._drawn_artists = self ._init_func ()
1159
- for a in self ._drawn_artists :
1160
- a .set_animated (self ._blit )
1159
+ if self ._blit :
1160
+ for a in self ._drawn_artists :
1161
+ a .set_animated (self ._blit )
1161
1162
1162
1163
def _draw_frame (self , framedata ):
1163
1164
# Save the data for potential saving of movies.
@@ -1170,5 +1171,6 @@ def _draw_frame(self, framedata):
1170
1171
# Call the func with framedata and args. If blitting is desired,
1171
1172
# func needs to return a sequence of any artists that were modified.
1172
1173
self ._drawn_artists = self ._func (framedata , * self ._args )
1173
- for a in self ._drawn_artists :
1174
- a .set_animated (self ._blit )
1174
+ if self ._blit :
1175
+ for a in self ._drawn_artists :
1176
+ a .set_animated (self ._blit )
0 commit comments