7

Graphical User Interfaces

Everything we have done so far has been text based. In fact, our Hangman game would not have looked out of place on a 1980s home computer. This chapter shows you how to create applications with a proper graphical user interface (GUI).

guizero

There are many Python libraries for creating GUIs, but perhaps the easiest to get started with is called guizero. guizero was created by Laura Sach and Martin O’Hanlan at the Raspberry Pi Foundation.

The guizero package is pre-installed on new versions of Raspberry Pi OS, so it’s ready waiting for us to use. However, it’s a good idea to make sure you have the latest version by running the following command in the terminal.

$ sudo pip3 install --upgrade guizero

Hello World

Get Programming the Raspberry Pi, Third Edition: Getting Started with Python, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.