mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Have MTex.__getitem__ call MTex.select_parts
This commit is contained in:
parent
4b73140435
commit
6277e28373
1 changed files with 6 additions and 0 deletions
|
@ -242,6 +242,12 @@ class MTex(StringMobject):
|
|||
result.append(self[start:end])
|
||||
return VGroup(*result)
|
||||
|
||||
def __getitem__(self, value: int | slice | str | re.Pattern) -> VMobject:
|
||||
# TODO, maybe move this functionality up to StringMobject
|
||||
if isinstance(value, (str, re.Pattern)):
|
||||
return self.select_parts(value)
|
||||
return super().__getitem__(value)
|
||||
|
||||
def get_tex(self) -> str:
|
||||
return self.get_string()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue