본문 바로가기

Programming/Manim Lectures

[03-1] Create "Hello Manim" (notepad++)

반응형

Let's make a video that displays the text 'Hello Manim' on the screen with notepad++ program and run the code using Command Prompt in Windows.

 

You can also use notepad, not notepad ++, or a common text editor like Ultraedit.
I recommend using PyCham as a development environment, but there is no problem in making a video using Manim even using general text editor such as notepad++.

If you want to use PyCham, skip this page and go to [03-2] Create "Hello Manim" (PyCham)

 

Install notepad++ program if you didn't have yet

If you don't have notepad++ program, download the install program from here and install it. 

If your PC is 64-bit Windows, choose 64-bit x96 version.

 

 

Run downloaded install program and choose default options asked from the installer.

(There will be no special thinngs or difficult things while installation.)

 

Change settings in Notepad++

There is no special change to develop Python and Manim coding in the Notepad++ but only one thing to be changed. That is tab size.

 

Generally, everyone use 4 spaces for indentation in Python coding, so we're going to change tab size to 4 spaces in the Notepad++.

 

  • Go to 'Settings > Preferences... > Language'
  • Check 'Replace by spece'
  • Type '4' for 'Tab size'
  • Press 'Close' button

 

We're not going to execute Python code directly in Notepad++ while there is a way to run it directly in Notepad++. In the case of Manim, it is convenient to execute the code in the Command Prompt window because the code is tested while continuously changing the execution parameters.

Create 'Hello Manim' code in the Notepad++

Please copy & paste below code to the Notepad++ editing window.

 

from manimlib.imports import *

class HelloManim(Scene):
    def construct(self):
        text=TextMobject("Hello Manim")
        self.play(Write(text))
        self.wait()

 

 

Save it as a file. Let's suppose you store it as 'C:/now/manim/src/hello.py' file.

 

I recommend you make a directory under 'C:/now/manim/' directory such as 'src', and save your code under the 'C:/now/manim/src/' directory. It makes clear seperation between your code files and others.

 

Run the code

Open 'Command Prompt Window' and move to 'C:/now/manim' directory

 

 

Type below command in the 'C:/now/manim' directory

 

   python -m manim src/hello.py HelloManim -pl

 

 

 

One video file will be generated in the 'C:/now/manim/media/videos/hello/480p15/HelloManim.pm4' and will be played automatically.

 

The play time of the video file will be 2 seconds. 

One second is playing a word of 'Hello Manim' and the remaining 1 second will be maintained the word.

 

 

 


Next: [03-2] Create "Hello Manim" (PyCham)

 

[03-2] Create "Hello Manim" (PyCham)

It's possible to use Notepad++ to make your code for Manim animation but I recommend you use PyCham as a code editor. The advantages of PyCham comapred to notepad++ are, Excellent automatic-code-com..

infograph.tistory.com

Go To: [99] Table of Contents

반응형

'Programming > Manim Lectures' 카테고리의 다른 글

[03-3] Explain about "Hello Manim" code  (0) 2020.05.31
[03-2] Create "Hello Manim" (PyCham)  (0) 2020.05.31
[03]Hello Manim  (0) 2020.05.31
[02-4]Multilingual setting in LaText  (0) 2020.05.31
[02-3]Using the Manim in the new directory  (0) 2020.05.31