(self, fig, event_source, blit=False)
| 884 | """ |
| 885 | |
| 886 | def __init__(self, fig, event_source, blit=False): |
| 887 | self._draw_was_started = False |
| 888 | |
| 889 | self._fig = fig |
| 890 | # Disables blitting for backends that don't support it. This |
| 891 | # allows users to request it if available, but still have a |
| 892 | # fallback that works if it is not. |
| 893 | self._blit = blit and fig.canvas.supports_blit |
| 894 | |
| 895 | # These are the basics of the animation. The frame sequence represents |
| 896 | # information for each frame of the animation and depends on how the |
| 897 | # drawing is handled by the subclasses. The event source fires events |
| 898 | # that cause the frame sequence to be iterated. |
| 899 | self.frame_seq = self.new_frame_seq() |
| 900 | self.event_source = event_source |
| 901 | self.event_source.add_callback(self._step) |
| 902 | |
| 903 | # Instead of starting the event source now, we connect to the figure's |
| 904 | # draw_event, so that we only start once the figure has been drawn. |
| 905 | self._first_draw_id = fig.canvas.mpl_connect('draw_event', self._start) |
| 906 | |
| 907 | # Connect to the figure's close_event so that we don't continue to |
| 908 | # fire events and try to draw to a deleted figure. |
| 909 | self._close_id = self._fig.canvas.mpl_connect('close_event', |
| 910 | self._stop) |
| 911 | if self._blit: |
| 912 | self._setup_blit() |
| 913 | |
| 914 | def __del__(self): |
| 915 | if not getattr(self, '_draw_was_started', True): |
no test coverage detected