Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

added TexMobject.add_background_rectangle_to_parts

Grant Sanderson3798e4550124
diff --git a/mobject/svg/tex_mobject.py b/mobject/svg/tex_mobject.py
index b28e7c9bc..2fbe11f3b 100644
--- a/mobject/svg/tex_mobject.py
+++ b/mobject/svg/tex_mobject.py
@@ -198,7 +198,7 @@ class TexMobject(SVGMobject):
split_self = self.split()
if part not in split_self:
raise Exception("Trying to get index of part not in TexMobject")
- return self.split().index(part)
+ return split_self.index(part)
def index_of_part_by_tex(self, tex, **kwargs):
part = self.get_part_by_tex(tex, **kwargs)
@@ -226,6 +226,11 @@ class TexMobject(SVGMobject):
self.submobjects = [self.background_rectangle, letters]
return self
+ def add_background_rectangle_to_parts(self):
+ for part in self:
+ part.add_background_rectangle()
+ return self
+
class TextMobject(TexMobject):
CONFIG = {