krassowski / jupyter-manim

manim cell magic for IPython/Jupyter to show the output video
MIT License
194 stars 11 forks source link

Doesn't work with Text object #13

Closed qo4on closed 4 years ago

qo4on commented 4 years ago
%%manim Shapes --base64 --low_quality --verbose

class Demo(Scene):
  def construct(self):
    text = Text('Hello, world!')
    self.play(Write(text))

Media will be written to ./media/. You can change this behavior with the --media_dir flag.

/tmp/tmpgj01amj5.py:15: UserWarning: Import from notebook: name already in the globals(), skipping warn('Import from notebook: ' + name + ' already in the globals(), skipping')

Shapes is not in the script

Traceback (most recent call last): File "/content/manim/manimlib/extract_scene.py", line 155, in main scene = SceneClass(**scene_kwargs) File "/content/manim/manimlib/scene/scene.py", line 53, in init self.construct() File "/tmp/tmpgj01amj5.py", line 23, in construct text = Text('Hello, world!') TypeError: init() takes 1 positional argument but 2 were given

It works with command line: !python3 -m manim example_scenes.py Demo -pl

krassowski commented 4 years ago

Shapes is not in the script

You are not rendering the Demo scene class, instead, you attempt to render a Shapes scene class.

%%manim Shapes --base64 --low_quality --verbose

should be

%%manim Demo --base64 --low_quality --verbose

qo4on commented 4 years ago

I have a lot of examples (more than 100) where it works in this way. image Actually I didn't notice that I have to change Shapes. I changed the class... and didn't touch the first line every time. And there were no errors. Can you explain why this is happening?

qo4on commented 4 years ago

I found the issue. When I uninstall jupyter-manim and install it again the Text class becomes unreachable for the whole notebook.

krassowski commented 4 years ago

I am happy that you found the culprit. It seems that it is not an issue with this package. Please re-open if any action is needed.