O'Reilly logo

Adventures in Python by Craig Richardson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required