User Guide

132
Python programs (or “scripts”) are text files that contain all of the
commands that you want to run. You can use any text editor to
create these files, but there is one built-in to the Python
packages on the Pi:
1. In the Python Shell, on the Application Menu, click
File and then click New Window.
2. Type print("Hello, World")
3. On the Application Menu, click File and then click
Save As. Save your file with the extension .py.
4. On the Application Menu, click Run and then click
Run Module.
The results of your program are shown in the Python Shell.
To run your program from a Linux terminal:
1. On the Application Launcher, click LXTerminal.
2. Type python3 followed by a space, and then the full
file name (including the file path) of your .py file.
If you want to run your program by clicking it on the desktop
then you need to create a desktop shortcut. These are short text
files that create additional icons on your desktop and describe
what happens when the user clicks them.
To create a desktop shortcut for a Python script:
1. Click the Raspbian Menu button, point to
Accessories, and then click Leafpad.
2. Type the following text into the document. Replace
My Test Script with what you want to call the icon,
and the file name after python3 with the location of
your .py program.
[Desktop Entry]
Type=Application
Name=My Test Script
Exec=lxterminal --command "python3 /home/pi/
Desktop/test.py"