在manim中解析“Text”对象

问题描述 投票:0回答:1

假设我有,

a1 = Text("hello world")

我想说:

if a1 == "hello world": 
    # then do something

但是我不能这样做,而且我知道如果我用

Tex
创建它,我可以使用
get_tex_string()
来获取字符串,但我想使用
Text
来做到这一点,因为正在用
Table
做一些事情在马尼姆,我说:

t1.get_rows()[0][0].line_text

我收到了文本,但它的形式是

Text("something")
,我无法解析它,我无法为此提出任何条件。

python text manim
1个回答
0
投票

根据Text

源代码,作为参数传递给
Text()
的字符串存储为
text
属性。

所以你可以使用

if a1.text == "hello world":
    # then do something
© www.soinside.com 2019 - 2024. All rights reserved.