Effective Tcl/Tk programming
Writing better programs with Tcl and Tk
Mark Harrison, Michael Mclennan - Collection Professional computing series
Résumé
The Tcl scripting language and the Tk toolkit create a powerful programming environment for building graphical user interfaces. With two lines of code you can create a simple button; with two hundred lines of code, a desktop calculator; and with a thousand lines of code, an industrial-strength groupware calendar and appointment minder. Your applications run on all of the major platforms: UNIX, Windows 95/NT, and Macintosh. You can even embed your programs in a Web page to make them available online.
Mark Harrison and Michael McLennan, two noted Tcl/Tk experts, combine their extensive experience in this practical programming guide. It is ideal for developers who are acquainted with the basics of Tcl/Tk and are now moving on to build real applications. Effective Tcl/Tk Programming shows you how to build Tcl/Tk applications effectively and efficiently through plenty of real-world advice. It clarifies some of the more powerful aspects of Tcl/Tk, such as the packer, the canvas widget, and binding tags. The authors describe valuable design strategies and coding techniques that will make your Tcl/Tk projects successful. You will learn how to:
- Create interactive displays with the canvas widget
- Create customized editors with the text widget
- Create new geometry managers, like tabbed notebooks or paned windows
- Implement client/server architectures
- Handle data structures
- Interface with existing applications
- Package Tcl/Tk code into reusable libraries
- Deliver Tcl/Tk applications that are easy to configure and install
- Embed applications in a Web page
- Build applications that will run on multiple platforms.
Table of contents :
Preface
Chapter 1: Building Tcl/Tk Applications
Application-building process
A small application
Designing the application
Designing the screen
Prototyping the screen
Library analysis
Adding behavior to the program
Adding finishing touches
Testing the program
Packaging the program
Chapter 2: Packing, Gridding, and Placing
Windows
Using the pack
command
Cavity-based model
Packing options
Packing order
Hierarchical packing
Compressing windows
Enlarging windows
Unpacking widgets
Using the grid
command
Grid-based model
Gridding options
Resizing windows
Mixing grid
and pack
Using the place
command
Coordinate-based model
Custom geometry managers
Chapter 3: Handling Events
The event loop
Keyboard focus
Forcing updates
Handling long-running bindings
Execution scope
Quoting and the event loop
Simple examples using bind
Selecting an item from a listbox
Automatic button help
Class bindings
Syntax of the bind
command
The event specification
Percent substitutions
More complex events
Click, drag, drop
Customizing widget behavior
Binding tags
Default binding tags
Using break
to interrupt event
processing
Inventing binding tags for groups of bindings
Binding to a toplevel widget
Debugging bindings
Displaying bindings
Monitoring events
Animation
Animating items on a canvas
Debugging after
events
Library procedures for animation
Chapter 4: Using the Canvas Widget
Understanding the canvas widget
Scrolling
Display list model
Using tags
Canvas bindings
Scrollable form
Progress gauge
HSB color editor
Tabbed notebook
Calendar
Handling size changes
Sensors and callbacks
Monitoring variables
Simple drawing package
Drawing items
Selecting items
Moving and deleting items
Configuring items
Resizing items
Entering text
Printing a drawing
Saving a drawing
Loading a drawing
Chapter 5: Using the Text Widget
Understanding the text widget
Indexing model
Scrolling
Using tags
Text bindings
Using marks
Wrap modes
Tab stops
Simple text editor
Read-only text display
Appointment editor
Using tags to apply styles
Embedded windows
Changing text bindings
Retrieving appointments
Hierarchical browser
Hierarchical data
Creating the hierarchical browser
Using tags and marks
Chapter 6: Top-level Windows
Toplevel widgets
Setting the widget class
Communicating with the window manager
Window placement
Window size
Simple dialogs
Modal dialogs
Controlling access to dialogs
Create/destroy strategy
Help from the window manager
Show/hide strategy
Unmanaged windows
Introductory placard
Balloon help
Chapter 7: Interacting with Other Programs
Executing other programs
Execution pipelines
Building commands and handling errors
Collecting output from long-running programs
Driving other programs without temporary files
Working around buffering problems
Seeing the problem
Fixing the problem
Bidirectional pipes
Buffering problems
Writing and reading
Graphical interface
Client/server architectures
Advantages
Disadvantages
A simple server
A simple client
Smarter parsing
Safer parsing
Asynchronous communication
Handling multiline requests
Network programming with sockets
Overview
A networked server
A networked client
A case study-the Electric Secretary
Downloading appointments from the server
Sending an appointment to the server
Handling schedule conflicts
Preferences
Persistent storage
Conclusions
Chapter 8: Delivering Tcl/Tk Applications
Adding polish to your application
Handling widget resources
Handling unexpected errors
Animated placard
Creating Tcl/Tk libraries
Designing library components
Synthesizing data structures
Adding callbacks to components
Autoloading
Packages
Desktop applications
Creating a distribution
Making scripts into executable programs
Making a self-installing program
Web-based applications
Simple example
A few important caveats
Security policies
Chapter 9: Developing Cross-Platform
Applications
User interface issues
Menu bars
Common dialogs
Virtual events
Fonts
Option database
File system issues
File names
File manipulation
End-of-line translations
Program invocation issues
Communicating with other programs
Environment variables
When all else fails
Appendix A: Getting Started with Tcl/Tk
Installing on Windows 95/NT
Installing on UNIX
Installing on Macintosh
Appendix B: Annotated Bibliography
Index
L'auteur - Mark Harrison
Autres livres de Mark Harrison
Caractéristiques techniques
PAPIER | |
Éditeur(s) | Addison Wesley |
Auteur(s) | Mark Harrison, Michael Mclennan |
Collection | Professional computing series |
Parution | 02/01/1998 |
Nb. de pages | 320 |
EAN13 | 9780201634747 |
Avantages Eyrolles.com
Consultez aussi
- Les meilleures ventes en Graphisme & Photo
- Les meilleures ventes en Informatique
- Les meilleures ventes en Construction
- Les meilleures ventes en Entreprise & Droit
- Les meilleures ventes en Sciences
- Les meilleures ventes en Littérature
- Les meilleures ventes en Arts & Loisirs
- Les meilleures ventes en Vie pratique
- Les meilleures ventes en Voyage et Tourisme
- Les meilleures ventes en BD et Jeunesse