Chapter 9. A tkinter Tour, Part 2

“On Today’s Menu: Spam, Spam, and Spam”

This chapter is the second in a two-part tour of the tkinter library. It picks up where Chapter 8 left off and covers some of the more advanced widgets and tools in the tkinter arsenal. Among the topics presented in this chapter:

  • Menu, Menubutton, and OptionMenu widgets

  • The Scrollbar widget: for scrolling text, lists, and canvases

  • The Listbox widget: a list of multiple selections

  • The Text widget: a general text display and editing tool

  • The Canvas widget: a general graphical drawing tool

  • The grid table-based geometry manager

  • Time-based tools: after, update, wait, and threads

  • Basic tkinter animation techniques

  • Clipboards, erasing widgets and windows, and so on

By the time you’ve finished this chapter, you will have seen the bulk of the tkinter library, and you will have all the information you need to compose larger, portable user interfaces of your own. You’ll also be ready to tackle the larger GUI techniques and more complete examples presented in Chapters 10 and 11. For now, let’s resume the widget show.

Menus are the pull-down lists you’re accustomed to seeing at the top of a window (or the entire display, if you’re accustomed to seeing them that way on a Macintosh). Move the mouse cursor to the menu bar at the top and click on a name (e.g., File), and a list of selectable options pops up under the name you clicked (e.g., Open, Save). The options within a menu might trigger actions, much like clicking on a button; ...

Get Programming Python, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.