Effective Tcl/Tk Programming: Writing Better Programs in Tcl and Tk
內容描述
Description
The Tcl scripting language and the Tk toolkit together create a programming environment for creating graphical user interfaces. There is increasing interest in using Tcl/Tk in university classes in order to free students to concentrate on algorithms, etc., rather than spending lots of time on implementation in a lower level language. Anyone who has read Ousterhout's definitive description of the language and wants to learn more about Tcl/Tk will find this book the perfect next step. Based on the authors' extensive experience building and deploying mission-critical Tcl software and teaching others to do the same, this book offers a wealth of practical information on how to exploit the full potential of this remarkable programming environment. Using real programs as examples, the book demonstrates Tcl and Tk concepts. It shows readers how to build Tcl applications effectively and efficiently through plenty of real-world advice, offers valuable design strategies, and points out pitfalls that readers should avoid. It clarifies the more confusing aspects of Tcl/Tk and thoroughly explains Tcl features that have no counterpart in conventional programming languages. Preface.
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.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.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.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.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.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.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.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.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. 0201634740T04062001