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)

買這商品的人也買了...

商品描述

 

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


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.


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.


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


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.


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

 

 



Back to Top

 

 

商品描述(中文翻譯)

描述

Tcl腳本語言和Tk工具包共同創建了一個用於創建圖形用戶界面的編程環境。越來越多的人對在大學課程中使用Tcl/Tk感興趣,以便讓學生專注於算法等方面,而不是花費大量時間在低級語言的實現上。任何已經閱讀過Ousterhout對該語言的明確描述並希望進一步了解Tcl/Tk的人都會發現這本書是下一步的完美選擇。基於作者在構建和部署關鍵任務的Tcl軟件以及教授他人進行相同工作的豐富經驗,本書提供了大量關於如何充分利用這個卓越的編程環境的實用信息。通過真實的程序示例,本書演示了Tcl和Tk的概念。它向讀者展示如何通過大量的實用建議有效高效地構建Tcl應用程序,提供有價值的設計策略,並指出讀者應該避免的陷阱。它澄清了Tcl/Tk中更令人困惑的方面,並詳細解釋了在傳統編程語言中沒有對應的Tcl功能。

前言。
1. 構建Tcl/Tk應用程序。

應用程序構建過程。
一個小應用程序。
設計應用程序。
設計屏幕。
原型屏幕。
庫分析。
為程序添加行為。
添加最後的修飾。
測試程序。
打包程序。

2. 打包、網格和放置窗口。

使用Pack命令。
基於空腔的模型。
打包選項。
打包順序。
分層打包。
壓縮窗口。
放大窗口。
取消打包小部件。
使用Grid命令。
基於網格的模型。
網格選項。
調整窗口大小。
混合使用網格和Pack。
使用Place命令。
基於坐標的模型。
自定義幾何管理器。

3. 處理事件。

事件循環。
鍵盤焦點。
強制更新。
處理長時間運行的綁定。
執行範圍。
引用和事件循環。
使用Bind進行簡單的示例。
從列表框中選擇項目。
自動按鈕幫助。
類綁定。
Bind命令的語法。
事件規範。
百分比替換。
更複雜的事件。
點擊、拖放。
自定義小部件行為。
綁定標籤。
默認綁定標籤。
使用Break中斷事件處理。
為一組綁定創建綁定標籤。
綁定到頂級小部件。
調試綁定。
顯示綁定。
監視事件。
動畫。
在畫布上動畫項目。
調試後事件。
動畫的庫程序。

4. 使用畫布小部件。