Next / Previous / Contents / Shipman's homepage

Abstract

Describes a graphical user interface widget that displays the fonts available with the Python programming language's Tkinter widget set.

This publication is available in Web form and also as a PDF document. Please forward any comments to john@nmt.edu.

Table of Contents

1. Introduction
2. Controls in the FontSelect widget
2.1. Design notes
3. Using the FontSelect widget in your Tkinter application
4. fontselector: A small test driver
4.1. The Application class
4.2. Application.__init__(): Constructor
4.3. Application._createWidgets(): Widget layout
4.4. Application._callback(): Observer function
4.5. Main program
5. fontselect.py: The module
5.1. Imported modules
5.2. Manifest constants
5.3. class FontSelect
5.4. FontSelect.__init__(): Constructor
5.5. FontSelect._createWidgets(): Widget placement
5.6. FontSelect._familyHandler(): Callback for family changes
5.7. FontSelect._controlHandler(): Callback for any font change
5.8. FontSelect.get(): Return the current font
5.9. FontSelect.getName(): Return the current font name
5.10. FontSelect.addObserver(): Register a callback
6. class FamilyPicker: Widgets for selecting the font family
6.1. FamilyPicker.__init__(): Constructor
6.2. FamilyPicker._listboxHandler()
7. class Controls: Controls frame
7.1. Controls.__init__(): Constructor
7.2. Controls._createWidgets()
7.3. Controls._createButtons(): Lay out the small controls frame
7.4. Controls._setFont(): Font change handler
7.5. Controls.setFamily(): Change font family name
7.6. Controls.getName(): Get the current font name
7.7. Controls.getFont(): Return the current font

1. Introduction

This document describes a graphical user interface widget that allows the user to select a particular text font. This widget works with the Tkinter graphical user interface for the Python programming language.

The document also contains the actual code of the widget, explained in a lightweight literate programming style.

Relevant documents:

Files extracted from this document: