调试¶
调试工具。
函数
- index_labels(mobject, label_height=0.15, background_stroke_width=5, background_stroke_color=ManimColor('#000000'), **kwargs)[来源]¶
返回一个
VGroup
的Integer
mobjects,显示每个子对象的索引。适用于处理复杂mobjects的部分。
- Parameters:
mobject (Mobject) – 将要标记其子对象的mobject。
label_height (float) – 标签的高度,默认为0.15。
background_stroke_width – 标签轮廓的描边宽度,默认为5。
background_stroke_color – 标签轮廓的描边颜色。
kwargs – 传递给用于构造标签的 :class`~.Integer` mobjects 的额外参数。
示例
示例:IndexLabelsExample ¶
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)