Third Edition: thoroughly revised and expanded! Over 20% new material. Updated for Python 3.9.
Quickly learn the right way to build attractive and modern graphical user interfaces with Python and Tkinter.
You know some Python. You want to create a user interface for your application. You don't want to waste time messing around with things you don't need.
It's built right into Python. Everything you need is included in the standard Python distributions. No extra downloads. Your Python and Tkinter scripts will work on Windows, macOS, and Linux.
Tkinter has a simple, clean, Pythonic API. It handles the tedious housekeeping needed in GUI programming. You can focus on what's unique in your application.
One HUGE Problem
Tkinter has been around for a very long time. There's a lot of documentation, much of it created years ago. Nearly everything in that documentation still works today.
But it's all wrong.
Tkinter has a reputation for ugly and outdated user interfaces that don't fit in with modern systems. And if you follow the old documentation, that's exactly what you'll get.
Tkinter has taken a quantum leap forward since all that documentation was written. There are new and better ways to build your user interface. Your program needs to be written differently to take advantage of that.
Modern Tkinter shows you the right way to do it.
You'll learn all the modern best practices. You'll build your user interface the right way the first time, without having to learn anything extra or irrelevant. It starts at the beginning, shows you what you need to know, and covers all the essential elements of building your modern user interface. This includes:
- all the standard GUI widgets
- attractively laying out your user interface
- managing menus, windows, and dialogs
- organizing more complex user interfaces
- Tkinter's powerhouse widgets: canvas and text
- customizing the look of your user interface
- making it all work on macOS, Windows, and Linux
You may have been using older documentation or are updating a Tkinter program written years ago. If so, you'll find warnings of what to avoid using, and how to replace it with a modern solution. There's even a full case study of modernizing the user interface of a seriously out-of-date Tkinter application you may be familiar with.
Who this book is for
This book is for everyday Python programmers looking to quickly create desktop user interfaces. You may be new to Tkinter, or want to bring your knowledge up to date. You don't need to be an expert on OOP, MVC architecture, multithreading, or other advanced topics. In fact, you're not going to need any of those things to use Tkinter.
This book uses Python 3.9, but everything you learn will apply (with small tweaks) to any Python 3.x version. It won't help you if you're using Python 2.x.
Let veteran software developer Mark Roseman show you the right way to build user interfaces with Python and Tkinter. He's been using Tk (the technology behind Tkinter) since its early days. He's shipped dozens of open source tools and commercial applications based on it.
He's also the author of the multi-lingual TkDocs.com website, the de facto reference for building modern Tk user interfaces. This book brings together Python-specific information from that site and supports its further development.
- A Brief History of Tk and Tkinter
- Installing Tkinter
- A First (Real) Example
- Tk Concepts
- Basic Widgets
- The Grid Geometry Manager
- More Widgets
- Event Loop
- Windows and Dialogs
- Organizing Complex Interfaces
- Fonts, Colors, Images
- Styles and Themes
- Case Study: IDLE Modernization