Tkinter Overview

Of all these GUI options, though, Tkinter is by far the de facto standard way to implement portable user interfaces in Python today, and the focus of this part of the book. Tkinter’s portability, availability, accessibility, documentation, and extensions have made it the most widely used Python GUI solution for many years running. Here are some of the reasons why:

Accessibility

Tkinter is generally regarded as a lightweight toolkit, and one of the simplest GUI solutions for Python available today. Unlike larger frameworks, it is easy to get started in Tkinter right away, without first having to grasp a much larger class interaction model. As we’ll see, programmers can create simple Tkinter GUIs in a few lines of Python code, and scale up to writing industrial-strength GUIs gradually.

Portability

A Python script that builds a GUI with Tkinter will run without source code changes on all major window platforms today: Microsoft Windows, X Windows (on Unix and Linux), and the Macintosh. Further, that same script will provide a native look-and-feel to its users on each of these platforms. A Python/Tkinter script looks like a Windows program on Windows; on Unix and Linux, it provides the same interaction but sports an appearance familiar to X Windows users; and on the Mac, it looks like a Mac program should.

Availability

Tkinter is a standard module in the Python library, shipped with the interpreter. If you have Python, you have Tkinter. Moreover, most Python installation ...

Get Programming Python, Second Edition 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.