Page 78 - Raspberry Pi as a Foundation for Boosting Computer and Technology Literacy
P. 78
6 Programming on the Raspberry Pi
( https://www.geany.org/), a versatile text editor with a GUI. Once
again, additional IDEs and text editors can be found in the Raspberry
Pi OS’s repositories and installed via the apt package manager.
Python
By default, Raspberry Pi OS includes both versions of Python, namely
Python 2 (Python Software Foundation 2020) and Python 3 (Python
Software Foundation 2021), to ensure compatibility. However, for our
current purpose, we will exclusively focus on Python 3, as it is the most
recent version and Python 2 no longer receives support or updates (Py-
thon Software Foundation, n.d.). Although Python 2 is still utilized to
some extent, users are strongly recommended to primarily rely on Py-
thon 3, resorting to Python 2 only when confronted with compatibility
issues (Monk 2022, 139–40).
Raspberry Pi OS users are provided with two pre-installed IDEs spe-
cifically tailored for Python programming: Mu (Tollervey, n.d.) and
Thonny ( https://thonny.org/). While both programs are decent,
Thonny is receiving significantly more attention in the guides and is
endorsed more frequently (Halfacree 2020, 93; Monk 2022, 140).
Python is an extremely versatile high-level programming language
that is known for its extensibility through a wide selection of libraries.
If not in the system’s repositories, additional libraries are typically in-
stalled through the pip (Python Software Foundation 2021) package
installer. This flexibility enables developers to create programs capable
of interacting with both the software and hardware components of
Raspberry Pi devices. The scope of software applications extends sig-
nificantly beyond mere data input and output (e.g. through the termi-
nal) and the manipulation of user files. Thus, for instance, Python can
be employed for developing GUI programs and games, aided by mod-
ules such as Pygame (2019) and PyQt5 (Riverbank Computing, n.d.).
Furthermore, the mcpi (O’Hanlon, n.d.) Python library empowers
users of the Raspberry Pi to engage with the native version of Mine-
craft Pi (Mojang AB, n.d.), a popular sandbox video game. Once a ‘new
world’ is created in Minecraft Pi, users gain the ability to manipulate
it through Python code. This includes a wide array of actions, from
printing out messages to in-game chat, changing a player’s location,
placing single or multiple blocks, as well as monitoring and modifying
their states (Philbin 2017, 130–143).
78