A community-maintained Python framework for creating mathematical animations.
Add helpful hints to `VGroup.add()` error message (#3561)
Václav Volhejn3b496ea2e6f1
diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.pyindex ac9058ddd..8312b7445 100644--- a/manim/mobject/types/vectorized_mobject.py+++ b/manim/mobject/types/vectorized_mobject.py@@ -2003,8 +2003,14 @@ class VGroup(VMobject, metaclass=ConvertToOpenGL):(gr-circle_red).animate.shift(RIGHT))"""- if not all(isinstance(m, (VMobject, OpenGLVMobject)) for m in vmobjects):- raise TypeError("All submobjects must be of type VMobject")+ for m in vmobjects:+ if not isinstance(m, (VMobject, OpenGLVMobject)):+ raise TypeError(+ f"All submobjects of {self.__class__.__name__} must be of type VMobject. "+ f"Got {repr(m)} ({type(m).__name__}) instead. "+ "You can try using `Group` instead."+ )+return super().add(*vmobjects)def __add__(self, vmobject: VMobject) -> Self: