Effective Tcl/Tk Programming: Writing Better Programs in Tcl and Tk

Mark Harrison, Michael McLennan

  • 出版商: Addison Wesley
  • 出版日期: 1997-12-08
  • 售價: $1,925
  • 貴賓價: 9.5$1,829
  • 語言: 英文
  • 頁數: 432
  • 裝訂: Paperback
  • ISBN: 0201634740
  • ISBN-13: 9780201634747
  • 相關分類: 程式語言
  • 立即出貨 (庫存 < 3)






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.
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.

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.

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.
Animating Items on a Canvas.
Debugging After Events.
Library Procedures for Animation.

4. Using the Canvas Widget.



Understanding the Canvas Widget.
Display List Model.
Using Tags.
Canvas Bindings.
Scrollable Form.
Progress Gauge.
HSB Color Editor.
Tabbed Notebook.
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.

5. Using the Text Widget.



Understanding the Text Widget.
Indexing Model.
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.

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.

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.
A Simple Server.
A Simple Client.
Smarter Parsing.
Safer Parsing.
Asynchronous Communication.
Handling Multiline Requests.
Network Programming with Sockets.
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.
Persistent Storage.

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.
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.

9. Developing Cross-Platform Applications.



User Interface Issues.
Menu Bars.
Common Dialogs.
Virtual Events.
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



Back to Top