diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 97e2cbc64ede..c6ff7702d992 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1769,8 +1769,8 @@ def _init_draw(self): self._drawn_artists = self._init_func() if self._blit: if self._drawn_artists is None: - raise RuntimeError('The init_func must return a ' - 'sequence of Artist objects.') + raise RuntimeError('When blit=True, the init_func must ' + 'return a sequence of Artist objects.') for a in self._drawn_artists: a.set_animated(self._blit) self._save_seq = [] @@ -1787,8 +1787,8 @@ def _draw_frame(self, framedata): if self._blit: - err = RuntimeError('The animation function must return a sequence ' - 'of Artist objects.') + err = RuntimeError('When blit=True, the animation function must ' + 'return a sequence of Artist objects.') try: # check if a sequence iter(self._drawn_artists) diff --git a/lib/matplotlib/animation.pyi b/lib/matplotlib/animation.pyi index 345e3c6dbe61..f725df8ebb22 100644 --- a/lib/matplotlib/animation.pyi +++ b/lib/matplotlib/animation.pyi @@ -206,9 +206,9 @@ class FuncAnimation(TimedAnimation): def __init__( self, fig: Figure, - func: Callable[..., Iterable[Artist]], + func: Callable[..., Iterable[Artist] | None], frames: Iterable | int | Callable[[], Generator] | None = ..., - init_func: Callable[[], Iterable[Artist]] | None = ..., + init_func: Callable[[], Iterable[Artist] | None] | None = ..., fargs: tuple[Any, ...] | None = ..., save_count: int | None = ..., *,