Skip to content

IndexError: list index out of range when running UpdatersExample (manimgl 1.7.2) #2457

Description

@gd247217

Describe the error

Running UpdatersExample raises IndexError: list index out of range
Could you please help me solve this problem?
I’m running the official example code, but I keep getting this error.
I really don’t know where I went wrong. All other examples work fine.
I’m not very familiar with programming, so I would appreciate your guidance.

Code and Error

Code:

class UpdatersExample(Scene):
    def construct(self):
        square = Square()
        square.set_fill(BLUE_E, 1)

        brace = always_redraw(Brace, square, UP)

        label = TexText("Width = 0.00")
        number = label.make_number_changeable("0.00")

        label.always.next_to(brace, UP)
        number.f_always.set_value(square.get_width)

        self.add(square, brace, label)

        self.play(
            square.animate.scale(2),
            rate_func=there_and_back,
            run_time=2,
        )
        self.wait()
        self.play(
            square.animate.set_width(5, stretch=True),
            run_time=3,
        )
        self.wait()
        self.play(
            square.animate.set_width(2),
            run_time=3
        )
        self.wait()

        now = self.time
        w0 = square.get_width()
        square.add_updater(
            lambda m: m.set_width(w0 * math.sin(self.time - now) + w0)
        )
        self.wait(4 * PI)

Error:

  File "D:\Manim\ManimGL\mgl\lib\site-packages\manimlib\mobject\types\vectorized_mobject.py", line 1313, in __getitem__
    return super().__getitem__(index)
  File "D:\Manim\ManimGL\mgl\lib\site-packages\manimlib\mobject\mobject.py", line 2189, in __getitem__
    return super().__getitem__(index)
  File "D:\Manim\ManimGL\mgl\lib\site-packages\manimlib\mobject\mobject.py", line 402, in __getitem__
    return self.split().__getitem__(value)
IndexError: list index out of range

Environment

OS System: Windows11
manim version:1.7.2
python version:3.10

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions