本文整理汇总了Python中mobject.tex_mobject.TexMobject.stretch_to_fit_height方法的典型用法代码示例。如果您正苦于以下问题:Python TexMobject.stretch_to_fit_height方法的具体用法?Python TexMobject.stretch_to_fit_height怎么用?Python TexMobject.stretch_to_fit_height使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mobject.tex_mobject.TexMobject
的用法示例。
在下文中一共展示了TexMobject.stretch_to_fit_height方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_brackets
# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import stretch_to_fit_height [as 别名]
def add_brackets(self):
bracket_pair = TexMobject("\\big[ \\big]")
bracket_pair.scale(2)
bracket_pair.stretch_to_fit_height(self.get_height() + 0.5)
l_bracket, r_bracket = bracket_pair.split()
l_bracket.next_to(self, LEFT)
r_bracket.next_to(self, RIGHT)
self.add(l_bracket, r_bracket)
self.brackets = VMobject(l_bracket, r_bracket)
return self
示例2: get_det_text
# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import stretch_to_fit_height [as 别名]
def get_det_text(matrix, determinant = None):
parens = TexMobject(["(", ")"])
parens.scale(2)
parens.stretch_to_fit_height(matrix.get_height())
l_paren, r_paren = parens.split()
l_paren.next_to(matrix, LEFT, buff = 0.1)
r_paren.next_to(matrix, RIGHT, buff = 0.1)
det = TextMobject("det").next_to(l_paren, LEFT, buff = 0.1)
det.add_background_rectangle()
det_text = VMobject(det, l_paren, r_paren)
if determinant is not None:
eq = TexMobject("=")
eq.next_to(r_paren, RIGHT, buff = 0.1)
result = TexMobject(str(determinant))
result.next_to(eq, RIGHT, buff = 0.2)
det_text.add(eq, result)
return det_text