9781118951798-c03f000

WHEN YOU USE computers, you’re probably used to interacting with programs using both a mouse and a keyboard. You click buttons and things happen. You enter information into text boxes, read messages displayed in dialogue boxes, and resize, minimise and close the boxes in which you’ve been working.

So far on your adventures here, you have created programs that interact with the user only by using text—in other words, you have only made programs that use Commandline Interfaces (or CLI). CLIs only allow users to interact with them through commands given from the keyboard and don’t allow them to use a mouse. You have been creating these programs by using the raw_input() function, where a prompt appears in the command line so the user can enter some characters that are then passed to the program. These programs are straightforward for programmers like yourself, of course! But most people expect programs to be nicely packaged in a window with buttons and all the other stuff they’re used to.

In this adventure, you’ll learn how to provide users with all of that, by creating Graphical User Interfaces (or GUI, which some people pronounce as “gooey”). A GUI is a program that allows the person using it to interact with it using a mouse and keyboard. Figure 3-1 shows a simple example of a GUI.

FIGURE 3-1 A simple GUI made in Tkinter

Get Adventures in Python 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.