当前位置: 首页>>代码示例>>Python>>正文


Python TextMobject.stretch_to_fit_height方法代码示例

本文整理汇总了Python中mobject.tex_mobject.TextMobject.stretch_to_fit_height方法的典型用法代码示例。如果您正苦于以下问题:Python TextMobject.stretch_to_fit_height方法的具体用法?Python TextMobject.stretch_to_fit_height怎么用?Python TextMobject.stretch_to_fit_height使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mobject.tex_mobject.TextMobject的用法示例。


在下文中一共展示了TextMobject.stretch_to_fit_height方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_corner_numbers

# 需要导入模块: from mobject.tex_mobject import TextMobject [as 别名]
# 或者: from mobject.tex_mobject.TextMobject import stretch_to_fit_height [as 别名]
    def get_corner_numbers(self, value, symbol):
        value_mob = TextMobject(value)
        width = self.get_width()/self.card_width_to_corner_num_width
        height = self.get_height()/self.card_height_to_corner_num_height
        value_mob.scale_to_fit_width(width)
        value_mob.stretch_to_fit_height(height)
        value_mob.next_to(
            self.get_corner(UP+LEFT), DOWN+RIGHT,
            buff = MED_LARGE_BUFF*width
        )
        value_mob.highlight(symbol.get_color())
        corner_symbol = symbol.copy()
        corner_symbol.scale_to_fit_width(width)
        corner_symbol.next_to(
            value_mob, DOWN, 
            buff = MED_SMALL_BUFF*width
        )
        corner_group = VGroup(value_mob, corner_symbol)
        opposite_corner_group = corner_group.copy()
        opposite_corner_group.rotate(
            np.pi, about_point = self.get_center()
        )

        return VGroup(corner_group, opposite_corner_group)
开发者ID:PythonJedi,项目名称:manim,代码行数:26,代码来源:probability.py


注:本文中的mobject.tex_mobject.TextMobject.stretch_to_fit_height方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。