Something that works nicely for me is to run manimgl.exe from Python in PyCharm using the subprocess module. It also goes well with using the run shortcut while iterating with small edits. I like to do this from the script in which my main scene is defined, for example, I have main.py which defines MyScene: from manimlib import * class MyScene(Scene): def construct(self): ... if __name__ == '__main__': import subprocess params = 'manimgl main.py MyScene -c WHITE'.split() subprocess.run(params, check=True, capture_output=True, text=True) # Possibly look at captured output hereThe code inside if __name__ ... does not execute when the same script is loaded by manim. What is nice is that one can easily add automation steps before or after the actual execution if needed and it keeps everything related in a single script. Edit: I also end the animations in the construct() method of MyScene with exit() to terminate the preview. I honestly don't know if this is good practice, but it works well for my usage pattern. Note that this does require that manimgl.exe reside somewhere that is in your path, in my case (Windows) I installed this for my global Python interpreter. I followed the instructions on GitHub and it works for me because the following is in my path: C:\Users\XXX\AppData\Local\Programs\Python\Python38\Scripts\It may vary depending on where your Python is installed. For a venv, you could do something like: params = '.\venv\Scripts\manimgl.exe ...'.split() (责任编辑:) |