Let's say in manim I have,
a1 = Text("hello world")
I want to say:
if a1 == "hello world":
# then do something
But I can't do this, and I understand if I create it with Tex
I could use get_tex_string()
to get the string, but I want to do this using Text
, because was doing something with Table
in manim and I said:
t1.get_rows()[0][0].line_text
And I got the text but it was in the form of Text("something")
and I can't parse this, I can't make any condition for this.
According to the source code of the Text
class (as of manim community edition v0.18.1), the string that is passed as argument to Text()
is stored as the original_text
attribute. After the string is processed (e.g. replacing tabs with spaces), it is also stored as the text
attribute.
So you could use a1.original_text
or a1.text
depending on your use case:
if a1.text == "hello world":
# then do something