This book includes full documentation for Tkinter, and also offers extensive examples for many real-world Python/Tkinter applications that will give programmers a quick start on their own projects.
Author(s): John E. Grayson
Publisher: Manning
Year: 1999
Language: English
Pages: 658
PythonAndTkinter
brief contents
contents
preface
special thanks
about the reader
about the author
conventions
about the cover
author online
Part 1: Basic concepts
Python
1.1 Introduction to Python programming and a feature review
1.1.1 Why Python?
1.1.2 Where can Python be used?
1.2 Key data types: lists, tuples and dictionaries
1.2.1 Lists
1.2.2 Tuples
1.2.3 Dictionaries
1.3 Classes
1.3.1 How do classes describe objects?
1.3.2 Defining classes
1.3.3 Neat Python trick #10
1.3.4 Initializing an instance
1.3.5 Methods
1.3.6 Private and public variables and methods
1.3.7 Inheritance
1.3.8 Multiple inheritance
1.3.9 Mixin classes
Tkinter
2.1 The Tkinter module
2.1.1 What is Tkinter?
2.1.2 What about performance?
2.1.3 How do I use Tkinter?
2.1.4 Tkinter features
2.2 Mapping Tcl/Tk to Tkinter
2.3 Win32 and Unix GUIs
2.4 Tkinter class hierarchy
2.5 Tkinter widget appearance
Building an application
3.1 Calculator example: key features
3.2 Calculator example: source code
3.3 Examining the application structure
3.4 Extending the application
Part 2: Displays
Tkinter widgets
4.1 Tkinter widget tour
4.1.1 Toplevel
4.1.2 Frame
4.1.3 Label
4.1.4 Button
4.1.5 Entry
4.1.6 Radiobutton
4.1.7 Checkbutton
4.1.8 Menu
4.1.9 Message
4.1.10 Text
4.1.11 Canvas
4.1.12 Scrollbar
4.1.13 Listbox
4.1.14 Scale
4.2 Fonts and colors
4.2.1 Font descriptors
4.2.2 X Window System font descriptors
4.2.3 Colors
4.2.4 Setting application-wide default fonts and colors
4.3 Pmw Megawidget tour
4.3.1 AboutDialog
4.3.2 Balloon
4.3.3 ButtonBox
4.3.4 ComboBox
4.3.5 ComboBoxDialog
4.3.6 Counter
4.3.7 CounterDialog
4.3.8 Dialog
4.3.9 EntryField
4.3.10 Group
4.3.11 LabeledWidget
4.3.12 MenuBar
4.3.13 MessageBar
4.3.14 MessageDialog
4.3.15 NoteBookR
4.3.16 NoteBookS
4.3.17 NoteBook
4.3.18 OptionMenu
4.3.19 PanedWidget
4.3.20 PromptDialog
4.3.21 RadioSelect
4.3.22 ScrolledCanvas
4.3.23 ScrolledField
4.3.24 ScrolledFrame
4.3.25 ScrolledListbox
4.3.26 ScrolledText
4.3.27 SelectionDialog
4.3.28 TextDialog
4.3.29 TimeCounter
4.4 Creating new megawidgets
4.4.1 Description of the megawidget
4.4.2 Options
4.4.3 Creating the megawidget class
Screen layout
5.1 Introduction to layout
5.1.1 Geometry management
5.2 Packer
5.2.1 Using the expand option
5.2.2 Using the fill option
5.2.3 Using the padx and pady options
5.2.4 Using the anchor option
5.2.5 Using hierarchical packing
5.3 Grid
5.4 Placer
5.5 Summary
Events, bindings and callbacks
6.1 Event-driven systems: a review
6.1.1 What are events?
6.1.2 Event propagation
6.1.3 Event types
6.2 Tkinter events
6.2.1 Events
6.3 Callbacks
6.4 Lambda expressions
6.4.1 Avoiding lambdas altogether
6.5 Binding events and callbacks
6.5.1 Bind methods
6.5.2 Handling multiple bindings
6.6 Timers and background procedures
6.7 Dynamic callback handlers
6.8 Putting events to work
6.8.1 Binding widgets to dynamic data
6.8.2 Data verification
6.8.3 Formatted (smart) widgets
6.9 Summary
Using classes, composites and special widgets
7.1 Creating a Light Emitting Diode class
7.1.1 Let’s try that again
7.1.2 What has changed?
7.2 Building a class library
7.2.1 Adding a hex nut to our class library
7.2.2 Creating a switch class
7.2.3 Building a MegaWidget
7.3 Summary
Dialogs and forms
8.1 Dialogs
8.1.1 Standard dialogs
8.1.2 Data entry dialogs
8.1.3 Single-shot forms
8.1.4 Tkinter variables
8.2 A standard application framework
8.3 Data dictionaries
8.4 Notebooks
8.5 Browsers
8.6 Wizards
8.7 Image maps
8.8 Summary
Panels and machines
9.1 Building a front panel
9.2 Modularity
9.3 Implementing the front panel
9.4 GIF, BMP and overlays
9.5 And now for a more complete example
9.6 Virtual machines using POV-Ray
9.6.1 And now for something completely different... #10 The Example
9.7 Summary
Drawing blobs and rubber lines
10.1 Drawing on a canvas
10.1.1 Moving canvas objects
10.2 A more complete drawing program
10.3 Scrolled canvases
10.4 Ruler-class tools
10.5 Stretching canvas objects
10.6 Some finishing touches
10.7 Speed drawing
10.8 Summary
Graphs and charts
11.1 Simple graphs
11.2 A graph widget
11.2.1 Adding bargraphs
11.2.2 Pie charts
11.3 3-D graphs
11.4 Strip charts
11.5 Summary
Navigation
12.1 Introduction: navigation models
12.2 Mouse navigation
12.3 Keyboard navigation: “mouseless navigation”
12.4 Building navigation into an application
12.5 Image maps
12.6 Summary
The window manager
13.1 What is a window manager?
13.2 Geometry methods
13.3 Visibility methods
13.4 Icon methods
13.5 Protocol methods
13.6 Miscellaneous wm methods
Part 3: Putting it all together...
Extending Python
14.1 Writing a Python extension
14.2 Building Python extensions
14.2.1 Linking an extension statically in Unix
14.2.2 Linking an extension statically in Windows
14.2.3 Building a dynamic module in Unix
14.2.4 Building a dynamic module in Windows
14.2.5 Installing dynamic modules
14.2.6 Using dynamic modules
14.3 Using the Python API in extensions
14.4 Building extensions in C++
14.5 Format strings
14.6 Reference counts
14.7 Embedding Python
14.8 Summary
Debugging applications
15.1 Why print statements?
15.2 A simple example
15.3 How to debug
15.4 A Tkinter explorer
15.5 pdb
15.6 IDLE
15.7 DDD
Designing effective graphics applications
16.1 The elements of good interface design
16.2 Human factors
16.2.1 Choosing fonts
16.2.2 Use of color in graphical user interfaces
16.2.3 Size considerations
16.3 Alternative graphical user interfaces
16.4 Summary
Programming for performance
17.1 Everyday speedups
17.1.1 Program organization
17.1.2 Using the Python optimizer
17.1.3 Examining code
17.2 Tkinter performance
17.2.1 Keep it short!
17.2.2 Eliminate local variables
17.2.3 Keep it simple
17.2.4 Fast initialization
17.2.5 Throttling events
17.3 Python techniques
17.3.1 Importing modules
17.3.2 Concatenating strings
17.3.3 Getting nested loops right
17.3.4 Eliminate module references
17.3.5 Use local variables
17.3.6 Using exceptions
17.3.7 Using map, filter and reduce
17.4 Application profiling
17.5 Python extensions
17.6 Summary
Threads and asynchronous techniques
18.1 Threading
18.1.1 Non-GUI threads
18.1.2 GUI threads
18.2 “after” processing
18.3 Summary
Distributing Tkinter applications
19.1 General issues in distributing applications
19.2 Distributing Unix applications
19.3 Distributing Win32 applications
19.4 Python distribution tools
Part 4: Appendices
Mapping Tk to Tkinter
General Tk widget information
The Canvas widget
Canvas item types
The Entry widget
The Listbox widget
The Menu widget
The Text widget
Text indices
The Button widget
The Checkbutton widget
The Frame widget
The Label widget
The Menubutton widget
The Message widget
The Radiobutton widget
The Scale widget
The Scrollbar widget
The Toplevel widget
The Image class
The bitmap image type
The PhotoImage type
Window information
The window manager
Binding and virtual events
Geometry management
The pack command
The place command
The grid command
Fonts
Other Tk commands
Tkinter reference
About this appendix
Common options
Options shared by most widgets
Options shared by many widgets
Inherited methods
Common widget methods
Winfo methods
Wm methods
Description
Bitmap class
Description
Inheritance
Shared options
Options specific to Bitmap
Methods
Button
Description
Inheritance
Shared options
Options specific to Button
Methods
Canvas
Description
Inheritance
Shared options
Options specific to Canvas
Methods
Canvas Arc
Description
Inheritance
Shared options
Options specific to Arc
Methods
Canvas bitmap
Description
Inheritance
Shared options
Options specific to Bitmap
Methods
Canvas image
Description
Inheritance
Shared options
Options specific to Image
Methods
Canvas line
Description
Inheritance
Shared options
Options specific to Line
Methods
Canvas oval
Description
Inheritance
Shared options
Options specific to Oval
Methods
Canvas polygon
Description
Inheritance
Shared options
Options specific to Polygon
Methods
Canvas rectangle
Description
Inheritance
Shared options
Options specific to Rectangle
Methods
Canvas text
Description
Inheritance
Shared options
Options specific to Text
Methods
Canvas window
Description
Inheritance
Shared options
Options specific to Window
Methods
Checkbutton
Description
Inheritance
Shared options
Options specific to Checkbutton
Methods
Entry
Description
Inheritance
Shared options
Options specific to Entry
Methods
Font class
Inheritance
Description
Shared options
Options specific to Font
Methods
Functions
Frame
Description
Inheritance
Shared options
Options specific to Frame
Methods
Grid geometry manager
Inheritance
Description
Shared options
Options specific to Grid
Methods
Label
Description
Inheritance
Shared options
Methods
Listbox
Description
Inheritance
Shared options
Options specific to Listbox
Methods
Menu
Description
Inheritance
Shared options
Options specific to Menu
Methods
Menubutton
Description
Inheritance
Shared options
Options specific to Menubutton
Methods
Message
Description
Inheritance
Shared options
Options specific to Message
Methods
OptionMenu class
Description
Inheritance
Shared options
Options specific to Widget
Methods
Pack geometry manager
Description
Inheritance
Shared options
Options specific to Pack
Methods
PhotoImage class
Description
Inheritance
Shared options
Options specific to PhotoImage
Methods
Place geometry manager
Description
Inheritance
Shared options
Options specific to Place
Methods
Radiobutton
Description
Inheritance
Shared options
Options specific to Radiobutton
Methods
Scale
Description
Inheritance
Shared options
Options specific to Scale
Methods
Scrollbar
Description
Inheritance
Shared options
Options specific to Scrollbar
Methods
Text
Description
Inheritance
Shared options
Options specific to Text
Methods
Toplevel
Description
Inheritance
Shared options
Options specific to Toplevel
Methods
Pmw reference: Python megawidgets
AboutDialog
Description
Inheritance
AboutDialog options
Components
Methods
Functions
Balloon
Description
Inheritance
Balloon options
Components
Methods
ButtonBox
Description
Inheritance
ButtonBox options
Components
Methods
ComboBox
Description
Inheritance
ComboBox options
Components
Methods
ComboBoxDialog
Description
Inheritance
ComboBoxDialog options
Components
Methods
Counter
Description
Inheritance
Counter options
Components
Methods
CounterDialog
Description
Inheritance
CounterDialog options
Components
Methods
Dialog
Description
Inheritance
Dialog options
Components
Methods
EntryField
Description
Validation function return values
Inheritance
EntryField options
Validators
Components
Methods
Group
Description
Inheritance
Group options
Components
Methods
LabeledWidget
Description
Inheritance
LabeledWidget options
Components
Methods
MegaArchetype
Description
Inheritance
Methods
MegaToplevel
Description
Inheritance
MegaToplevel options
Components
Methods
MegaWidget
Description
Inheritance
Components
Methods
MenuBar
Description
Inheritance
MenuBar options
Components
Methods
MessageBar
Description
Inheritance
MessageBar options
Components
Methods
MessageDialog
Description
Inheritance
MessageDialog options
Components
Methods
NoteBook
Description
Inheritance
NoteBook options
Components
Methods
NoteBookR
Description
Inheritance
NoteBookR options
Components
Methods
NoteBookS
Description
Inheritance
NoteBookS options
Components
Methods
OptionMenu
Description
Inheritance
OptionMenu options
Components
Methods
PanedWidget
Description
Inheritance
PanedWidget options
Pane options
Components
Methods
PromptDialog
Description
Inheritance
PromptDialog options
Components
Methods
RadioSelect
Description
Inheritance
RadioSelect options
Components
Methods
ScrolledCanvas
Description
Inheritance
ScrolledCanvas options
Components
Methods
ScrolledField
Description
Inheritance
ScrolledField options
Components
Methods
ScrolledFrame
Description
Inheritance
ScrolledFrame options
Components
Methods
ScrolledListBox
Description
Inheritance
ScrolledListBox options
Components
Methods
ScrolledText
Description
Inheritance
ScrolledText options
Components
Methods
SelectionDialog
Description
Inheritance
SelectionDialog options
Components
Methods
TextDialog
Description
Inheritance
TextDialog options
Components
Methods
TimeCounter
Description
Inheritance
TimeCounter options
Components
Methods
Building and installing Python, Tkinter
Building for Unix
Obtaining source distributions
Building Tcl
Building Tk
Building Python
Building for Windows
Obtaining source distributions
Building Tcl
Building Tk
Building Python
Building for MacOS
Events and keysyms
Modifiers
Event types
Qualifier
Keysyms
E.5.1 Latin-1
Cursors
References
Resources
Siomodule
SWIG
NumPy
Python News Group
Python Imaging Library (PIL)
PythonWorks
Python books
X Window books
Tcl/Tk books
Human factors engineering
index