3b1b / 3b1b/manim

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

Aperta
#2,457 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
93.8k
Fork
7.7k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

### 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**:

```python
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**:
``` self.replace_submobject(self.submobjects.index(part[0]), decimal_mob)
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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.