调试

调试工具。

函数

index_labels(mobject, label_height=0.15, background_stroke_width=5, background_stroke_color=ManimColor('#000000'), **kwargs)[source]

返回一个VGroupInteger mobject,显示每个子对象的索引。

对于处理复杂mobject的各个部分很有用。

参数:
  • mobject (Mobject) – 将对其子对象进行标注的mobject。

  • label_height (float) – 标签的高度,默认为0.15。

  • background_stroke_width (float) – 标签轮廓的描边宽度,默认为5。

  • background_stroke_color (ManimColor) – 标签轮廓的描边颜色。

  • kwargs (Any) – 传递给用于构造标签的:class`~.Integer` mobject的额外参数。

返回类型:

VGroup

示例

示例: IndexLabelsExample

../_images/IndexLabelsExample-1.png
from manim import *

class IndexLabelsExample(Scene):
    def construct(self):
        text = MathTex(
            "\\frac{d}{dx}f(x)g(x)=",
            "f(x)\\frac{d}{dx}g(x)",
            "+",
            "g(x)\\frac{d}{dx}f(x)",
        )

        #index the fist term in the MathTex mob
        indices = index_labels(text[0])

        text[0][1].set_color(PURPLE_B)
        text[0][8:12].set_color(DARK_BLUE)

        self.add(text, indices)
class IndexLabelsExample(Scene):
    def construct(self):
        text = MathTex(
            "\\frac{d}{dx}f(x)g(x)=",
            "f(x)\\frac{d}{dx}g(x)",
            "+",
            "g(x)\\frac{d}{dx}f(x)",
        )

        #index the fist term in the MathTex mob
        indices = index_labels(text[0])

        text[0][1].set_color(PURPLE_B)
        text[0][8:12].set_color(DARK_BLUE)

        self.add(text, indices)

print_family(mobject, n_tabs=0)[source]

用于调试目的

参数:
返回类型: