3b1b / manim

Animation engine for explanatory math videos
MIT License
67.99k stars 6.07k forks source link

Easier way to run a script #465

Closed kolibril13 closed 5 years ago

kolibril13 commented 5 years ago

Hi, I am looking for an easy way to run my animations. At the moment it looks like this, and I just execute the script by pressing "Run" in pycharm. However with this method, I have to add the last 4 lines to every animation script, which is not very handy. The only alternative I see is to type the whole line ´python3.7 -m manim -pl ...´ into the terminal. But I am more looking for a "press only one key and run" option. Do you have any idea for me, how to do this in an elegant way? Thank you and all the best!


from big_ol_pile_of_manim_imports import *

class EasyScence(Scene):
    def construct(self):
        dot = Dot()
        self.add(dot)
        self.wait(2)

if __name__ == "__main__":
    module_name = os.path.basename(__file__)
    command = "python3.7 -m manim -pl -a " + module_name
    os.system(command)
CadenScharpf commented 5 years ago

Most terminals should just let you up arrow to previous entries but have you considered writing a batch file?

eulertour commented 5 years ago

I'm not quite sure what you're looking for, but you could always define a bash function or alias to pass the arguments you want automatically.

kolibril13 commented 5 years ago

Okay, thank you, I will try it with an batch file