LinearTransformationSceneExample does not work in Colab
Description of bug / unexpected behavior
I'm trying to change the base configurations for LinearTransformationScene, but I get an error. This was not the case when I was using the previous version of Manim a few days ago
Expected behavior
I was hoping to change the configs without getting an error
How to reproduce the issue
Following is some example code taken from the docs. The first line was to get it to run in Google Colab (as described in the tutorials section)
%%manim LinearTransformationSceneExample
class LinearTransformationSceneExample(LinearTransformationScene):
def __init__(self):
LinearTransformationScene.__init__(
self,
show_coordinates=True,
leave_ghost_vectors=True,
)
def construct(self):
matrix = [[1, 1], [0, 1]]
self.apply_matrix(matrix)
self.wait()
Logs
Terminal output
TypeError: __init__() got an unexpected keyword argument 'renderer'
System specifications
System Details
Google Colab's settings
Python version
python3
FFMPEG
Output of ffmpeg -version:
ffmpeg version 3.4.8-0ubuntu0.2
Additional comments
Can you try to change the code to
class LinearTransformationSceneExample(LinearTransformationScene):
def __init__(self, **kwargs):
LinearTransformationScene.__init__(
self,
show_coordinates=True,
leave_ghost_vectors=True,
**kwargs,
)
def construct(self):
matrix = [[1, 1], [0, 1]]
self.apply_matrix(matrix)
self.wait()
and see whether this helps?
Yes! That fixed it. Could you briefly explain why?
Thanks!
Yes! That fixed it. Could you briefly explain why?
Thanks!
Of course! Apologies for the delay: When rendering a scene in Colab (or generally in Jupyter Notebooks), the renderer gets passed to the scene as an additional keyword argument; this is part of the %%manim IPython magic.
The way the example in the documentation is currently written does not allow for additional keyword arguments; by adding **kwargs to both the custom __init__ of your scene, as well as to the corresponding LinearTransformationScene.__init__ call, the keyword is propagated properly.
The issue should remain open (and I've also renamed it a bit) until the example in the documentation is changed accordingly.
Thank you for your clear explanation!
I could write about it in the docs, but let me check if I understand correctly what is going on: By default, the cell magic %%manim feeds the constructor with the appropriate renderer to display the output in the IPython cell. So basically only the example needs to be changed or should also contain a note pointing out to this detail?
@Tsukalos @behackl Do you need any help with this issue? I can work on it