O'Reilly logo

Introduction to Computing Using Python: An Application Development Focus by Ljubomir Perkovic

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

CHAPTER 9

Graphical User Interfaces

9.1 Basics of tkinter GUI Development

9.2 Event-Based tkinter Widgets

9.3 Designing GUIs

9.4 OOP for GUIs

9.5 Case Study: Developing a Calculator

Chapter Summary

Solutions to Practice Problems

Exercises

Problems

THIS CHAPTER INTRODUCES graphical user interface (GUI) development.

When you use a computer application—whether it is a web browser, an email client, a computer game, or your Python integrated development environment (IDE)—you typically do so through a GUI, using a mouse and a keyboard. There are two reasons for using a GUI: A GUI gives a better overview of what an application does, and it makes it easier to use the application.

In order to develop GUIs, a developer will require a GUI application programming interface (API) that provides the necessary GUI toolkit. There are several GUI APIs for Python; in this text we use tkinter, a module that is part of Python's Standard Library.

Beyond the development of GUIs using tkinter, this chapter also covers fundamental software development techniques that are naturally used in GUI development. We introduce event-driven programming, an approach for developing applications in which tasks are executed in response to events (such a button clicks). We also learn that GUIs are ideally developed as user-defined classes, and we take the opportunity to once again showcase the benefit of object-oriented programming (OOP).

9.1 Basics of tkinter GUI Development

A graphical user interface (GUI) consists ...

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