Notice in Figure 3.11 that the file has a .py on the end of it. This file extension
identifies files as Python scripts. Thus, all your Python programs should be named
something like filename.py.
Using a Text Editor to Create a Python Script
There are other text editors available to you besides the one in IDLE. Two of them are available by
default on Raspbian. One is Leaf Pad, which is geared toward school-age children. The other is nano.
The nano text editor is small and lightweight, so it is perfect for the Raspberry Pi. Compared to other
more complicated text editors, nano is fairly easy to use. Its biggest advantage over the text editor in
IDLE is that nano can be used in both the GUI and at the command line!
To start the nano text editor at the command line, you just type the command nano and press Enter.
To start the nano text editor in the GUI, you click on the LXDE Programs Menu icon on the far left of
the LXPanel, hover over the Other menu so its submenu is displayed, and then click the Nano menu
selection.
Note that the nano text editor does not perform any syntax checking while you type in Python
statements. It also does not do any color coding while you type statements. And it does not perform
any auto-indentation. nano doesn’t give you any handholding when you’re creating and editing Python
scripts.
Figure 3.12 shows the nano text editor in the GUI. Notice that in the GUI, the LXTerminal is opened,
and the nano editor is being used within it. The title bar of the nano editor program window is the line
where the left side starts with “GNU nano” and the nano editor version number. In the middle of the
title bar are either the words “New Buffer” if you are creating a new file or the name of the file you
are editing.
FIGURE 3.12 The nano text editor.
The nano editor’s middle panel is the editing area. This is where you can add Python statements or
make changes to existing ones.
By the Way: Messages and Questions