Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7cb9d1f

Browse filesBrowse files
committed
Merge pull request #6336 from tacaswell/mnt_stricter_animation
MNT: be explicitly strict in FunctionAnimation
2 parents 38d9638 + 65507a0 commit 7cb9d1f
Copy full SHA for 7cb9d1f

File tree

Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed

‎lib/matplotlib/animation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,8 +1113,8 @@ class FuncAnimation(TimedAnimation):
11131113
results of drawing from the first item in the frames sequence will be
11141114
used. This function will be called once before the first frame.
11151115
1116-
If blit=True, *func* and *init_func* should return an iterable of
1117-
drawables to clear.
1116+
If blit=True, *func* and *init_func* must return an iterable of
1117+
artists to be re-drawn.
11181118
11191119
*kwargs* include *repeat*, *repeat_delay*, and *interval*:
11201120
*interval* draws a new frame every *interval* milliseconds.
@@ -1195,6 +1195,9 @@ def _init_draw(self):
11951195
else:
11961196
self._drawn_artists = self._init_func()
11971197
if self._blit:
1198+
if self._drawn_artists is None:
1199+
raise RuntimeError('The init_func must return a '
1200+
'sequence of Artist objects.')
11981201
for a in self._drawn_artists:
11991202
a.set_animated(self._blit)
12001203
self._save_seq = []
@@ -1211,5 +1214,8 @@ def _draw_frame(self, framedata):
12111214
# func needs to return a sequence of any artists that were modified.
12121215
self._drawn_artists = self._func(framedata, *self._args)
12131216
if self._blit:
1217+
if self._drawn_artists is None:
1218+
raise RuntimeError('The animation function must return a '
1219+
'sequence of Artist objects.')
12141220
for a in self._drawn_artists:
12151221
a.set_animated(self._blit)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.