Instructions
APPENDIX B. GUI ZERO
Laura Sach and Martin O’Hanlon at The Raspberry Pi Foundation have created a
Python library (GUI Zero) that makes it super easy to design GUIs. This kit uses
that library.
Before you can use the library, you need to import the bits of it that you want to use
in your program.
For example, if we just wanted a window containing a message, here's the import
command:
from guizero import App, Text
The class App represents the application itself, and every program you write that
uses guizero needs to import this. The only other class needed here is Text, that is
used to display the message.
The following command creates the application window, specifying a title and the
window's starting dimensions.
app = App(title = "My Window", width="400", height="300")
To add some text to the window, we can use the line:
Text(app, text="Hello World", size=32)
The window is now prepared for display, but won't actually appear until the program
runs the line:
app.display()
You can find out more about guizero here: https://lawsie.github.io/guizero/start/
Page 21