Running your Program

Using Command Prompt to Run your Program

You can run your script by using your computer’s “Terminal” or “Command Prompt”. When you open it, it should look something like this:

../../_images/running-your-program-1.png

At the moment it’s pointing to its default directory, which is typically the user directory in C:\Users\username, /home/user or /Users/user, depending on your operating system. We need to change the directory to the one where we saved our script. To do this, we use the cd command. This stands for ‘change directory’. For example, if the script is saved in a MyProject folder inside the home directory, we should type this:

cd MyProject

Please note that this folder name is case-sensitive and must match exactly. Then, press the ‘Enter’ key on your keyboard. You should now have the following on the Command Prompt:

../../_images/running-your-program-2.png

This means that it’s now pointing to the right directory. Assuming the script has been named main.py, type the following text after the > symbol:

python main.py
../../_images/running-your-program-3.png

Press the ‘Enter’ key on your keyboard. If all is well, Panda3D will start and you should see the main rendering window appear.

../../_images/running-your-program-4.png

This is an empty program, it won’t do anything. The next step is to add additional commands to the program, as described in one of the following tutorials.