ManimCommunity / ManimPango

Binding for Pango, to use with Manim.
https://manimpango.manim.community
MIT License
41 stars 13 forks source link

Creating Text Mobject retrieves TypeError (manimpango.text2svg has incorrect argument typing) #106

Closed mkashirin closed 9 months ago

mkashirin commented 9 months ago

Hello. I'm having a trouble rendering a Text Mobject. An attempt of creating a Text Mobject retrieves TypeError because manimpango.text2svg function has incorrect argument typing (size: int, line_spacing: int istead of both beingfloat). Traceback is represented on screenshots attached. The problem is I just don't know how to save any type of changes made to them .pyx files.

Steps to reproduce the problem:

  1. install Anaconda 3 on Windows 11 Pro;
  2. install Manim with the following command conda install -c conda-forge manim on Conda's Python 3.11.6;
  3. try to run the code from the Screenshot 1 or render the text typing manim -pqh scene.py TextAnimation.

Screenshots: screenshot 1: Снимок экрана 2023-10-13 191126; screenshot 2: Снимок экрана 2023-10-13 191315.

Thanks for your response.

uwezi commented 9 months ago

don't just use screenshots - especially not for your code!

class TextAnimation(Scene):
    def construct(self):
        text = Text("Book Antiqua", font="Book Antiqua")
        self.play(Write(text))
        self.play(Unwrite(text))
uwezi commented 9 months ago

Ok, I finally updated my Python to a recent Python 3.11 (not Anaconda, but plain Windows-version of Python from python.org) and I still cannot reproduce your problem.

mkashirin commented 9 months ago

Basically, I can try installing Manim via pip into pure Python venv. Not sure it'll help, but still...

mkashirin commented 9 months ago

So, I installed it manually into the pure Python virtual environment, created via PyCharm, and everything works just perfect. It seems like the problem with either VSCode or Conda itself. Thanks for your response.

naveen521kk commented 9 months ago

Cython 3 started to enforce type-checking more strictly which caused this issue. On normal Python, the wheel from PyPI would be installed which should be built with Cython 0.x. Conda seems to have built this project with Cython 3.

https://github.com/ManimCommunity/ManimPango/pull/105 seems to have fixed most of the issues, I'll do a bit more testing and release a new version.

I'll keep this open for a bit till I release a new version.

alexandross commented 8 months ago

I am using conda, I updated today both conda and the manimCE environment inside conda, and I started to get this error. It was working fine previously. Any assistance would be greatly appreciated. Thank you!

behackl commented 8 months ago

I am using conda, I updated today both conda and the manimCE environment inside conda, and I started to get this error. It was working fine previously. Any assistance would be greatly appreciated. Thank you!

Wait for the upcoming release, or just try and run pip install manimpango --force.

alexandross commented 8 months ago

Thank you! I just installed manim in my "base" environment (outside of the "manimCE" conda environment) using "pip3 install manim" and it works. I will keep updating the manimCE conda environment, hopefully a future update will fix it.

smadikanti commented 4 months ago

Issue still persists

uwezi commented 4 months ago

@smadikanti

Issue still persists

well, the issue has been fixed as reported by others.

Which version of Manim and which version of Python are you using on what operating system? And did you follow the advice above to run pip install manimpango --force?