|

Addison-Wesley / Prentice Hall

Computer Science

My Instructor Resource Center :  Log in or request access

Tcl and the Tk Toolkit
John K. OusterhoutSun Microsystems

ISBN-10: 020163337X
ISBN-13:  9780201633375

Publisher:  Addison-Wesley Professional
Copyright:  1994
Format:  Paper; 480 pp
Published:  03/31/1994
Status: Instock


    New edition available

Since Tcl and the Tk Toolkit is written by the creator of the Tcl scripting language and the Tk toolkit, this book is the single authoritative resource for anyone who wants to produce far more powerful X Window System applications in a fraction of the time that would otherwise be required. Tcl and the Tk Toolkit offers an introduction and overview of this impressive programming environment, including detailed instructions for script writing in Tcl and working with the Tk toolkit. The book also describes the C interfaces for Tcl and Tk for those readers who wish to extend their built-in features by writing new C commands.



1. Introduction.

Introduction.

Organization of the Book.

Notation.

Pronunciation.

Versions.



2. An Overview of Tcl and Tk.

Getting Started.

Hello World with Tk.

Script Files.

Variables and Substitutions.

Control Structures.

On the Tcl Language.

Event Bindings.

Subprocesses.

Additional Features of Tcl and Tk.

Extensions and Applications.

I. THE TCL LANGUAGE.

3. Tcl Language Syntax.

Scripts, Commands, and Words

Evaluating a Command.

Variable Substitution.

Command Substitution.

Backslash Substitution.

Quoting with Double Quotes.

Quoting With Braces.

Comments.

Normal and Exceptional Returns.

More on Substitutions.

4. Variables.

Simple Variables and the Set Command.

Arrays.

Variable Substitution.

Removing Variables: Unset.

Multidimensional Arrays.

The Incr and Append Commands.

Predefined Variables.

Preview of Other Variable Facilities.

5. Expressions.

Numeric Operands.

Operators and Precedence.

Math Functions.

Substitutions.

String Manipulation.

Types and Conversions.

Precision.

6. Lists.

Basic List Structure and the Lindex Command.

Creating Lists: Concat, List, and Llength.

Modifying Lists: Linsert, Lreplace, Lrange, and Lappend.

Searching Lists: Lsearch.

Sorting Lists: Lsort.

Converting Between Strings and Lists: Split and Join.

Lists and Commands.

7. Control Flow.

The If Command.

Looping Commands: While, For, and Foreach.

Loop Control: Break and Continue.

The Switch Command.

The Eval Command.

Executing From Files: Source.

8. Procedures.

Procedure Basics: Proc and Return.

Local and Global Variables.

Defaults and Variable Numbers of Arguments.

Call By Reference: Upvar.

Creating New Control Structures: Uplevel.

9. String Manipulation.

Character Set Issues.

Glob-Style Pattern Matching.

Pattern Matching with Regular Expressions.

Using Regular Expressions for Substitutions.

Generating Strings with Format.

Parsing Strings With Scan.

Extracting Characters: String Index and String Range.

Searching and Comparison.

Length, Case Conversion, and Trimming.

10. Accessing Files.

File Names.

Basic File I/O.

Output Buffering.

Random Access to Files.

The Current Working Directory.

Manipulating File Names: Glob and File.

File Information Commands.

Errors in System Calls.

11. Processes.

Invoking Subprocesses with Exec.

I/O To and From a Command Pipeline.

Process Ids.

Environment Variables.

Terminating the Tcl Process with Exit.

12. Errors and Exceptions.

What Happens after an Error?

Generating Errors from Tcl Scripts.

Trapping Errors with Catch.

Exceptions in General.

13. Managing Tcl Internals.

Querying the Elements of an Array.

The Info Command.

Timing Command Execution.

Tracing Operations on Variables.

Renaming and Deleting Commands.

Unknown Commands.

Autoloading.

14. History.

The History List.

Specifying Events1.

Reexecuting Commands from the History List.

Shortcuts Implemented by Unknown.

Current Event Number: History Nextid.

II. WRITING SCRIPTS FOR TK.

15. An Introduction to Tk.

A Brief Introduction to X.

Widgets.

Applications, Top-Level Widgets, and Screens.

Scripts and Events.

Creating and Destroying Widgets.

Geometry Managers.

Widget Commands.

Commands for Interconnection.

16. A Tour of the Tk Widgets.

Frames.

Toplevels.

Labels.

Buttons, Checkbuttons, and Radiobuttons.

Messages.

Listboxes.

Scrollbars.

Scales.

Entries.

Menus and Menubuttons.

Other Common Options.

17. Geometry Managers: the Packer.

An Overview of Geometry Management.

Packer Basics.

The Pack Command and -Side Options.

Padding.

Filling.

Expansion.

Anchors.

Packing Order.

Hierarchical Packing.

Other Options to the Pack Command.

Other Geometry Managers in Tk.

18. Bindings.

X Events.

An Overview of the Bind Command.

Event Patterns.

Sequences of Events.

Substitutions in Scripts.

Conflict Resolution.

When are Events Processed?

Background Errors: Tkerror.

Other Uses of Bindings.

19. Canvas and Text Widgets.

Canvas Basics: Items and Types.

Manipulating Items with Identifiers and Tags.

Bindings.

Other Canvas Features.

Text Widgets.

Text Indices and Marks.

Text Tags.

20. The Selection.

Selections, Retrievals, and Targets.

Locating and Clearing the Selection.

Supplying the Selection with Tcl Scripts.

21. The Input Focus.

Focus Model: Explicit vs. Implicit.

Setting The Input Focus.

Clearing The Focus.

The Default Focus.

Shortcuts.

22. Window Managers.

Window Sizes.

Gridded Windows.

Window Positions.

Window States.

Decorations.

Window Manager Protocols.

Special Handling: Transients, Groups, and Override-Redirect.

Session Management.

A Warning about Window Managers.

23. The Send Command.

Basics.

Hypertools.

Application Names.

Security Issues.

24. Modal Interactions.

Grabs.

Keyboard Handling During Grabs.

Waiting: The Tkwait Command.

25. More on Configuration Options.

The Option Database.

Option Database Entries.

The RESOURCE_MANAGER Property and .Xdefaults File.

Priorities in the Option Database.

The Option Command.

The Configure Widget Command.

26. Odds and Ends.

Destroying Widgets.

Time Delays.

The Update Command.

Information about Widgets.

Raise and Lower.

The Tk Command: Color Models.

Variables Managed by Tk.

27. Examples.

A Procedure that Generates Dialog Boxes.

A Remote-Control Application.

III. WRITING TCL APPLICATIONS IN C.

28. Philosophy.

C vs. Tcl: Primitives.

Object Names.

Commands: Action-Oriented vs. Object-Oriented.

Representing Information.

29. Interpreters and Script Evaluation.

Interpreters.

A Simple Tcl Application.

Other Evaluation Procedures.

Deleting Interpreters.

30. Creating New Tcl Commands.

Command Procedures.

Registering Commands.

The Result Protocol.

Procedures for Managing the Result.

Clientdata and Deletion Callbacks.

Deleting Commands.

How Tcl Procedures Work.

31. Tcl_AppInit and Packages.

Tcl_AppInit.

Defining Packages.

32. Parsing.

Numbers and Booleans.

Expression Evaluation.

Manipulating Lists.

33. Exceptions.

Completion Codes.

Augmenting the Stack Trace in errorInfo.

Setting errorCode.

34. Accessing Tcl Variables.

Naming Variables.

Setting Variable Values.

Reading Variables.

Unsetting Variables.

Linking Tcl and C Variables.

Setting and Unsetting Variable Traces.

Trace Callbacks.

Whole-Array Traces.

Multiple Traces.

Unset Callbacks.

Nonexistent Variables.

Querying Trace Information.

35. Hash Tables.

Keys and Values.

Creating and Deleting Hash Tables.

Creating Entries.

Finding Existing Entries.

Searching.

Deleting Entries.

Statistics.

36. String Utilities.

Dynamic Strings.

Command Completeness.

String Matching.

37. POSIX Utilities.

Tilde Expansion.

Generating Messages.

Creating Subprocesses.

Background Processes.

IV. TK'S C INTERFACES.

38. Introduction.

What's in a Widget?

The Relationship Between Tk and Xlib.

Square: An Example Widget.

tk.h.

Design for Reusability.

39. Creating Windows.

Windows and Tk_Windows.

Creating Tk_Windows.

Setting a Window's Class.

Deleting Windows.

Basic Operations on Tk_Windows.

Class Command Procedures.

Package Initialization.

Delayed Window Creation.

40. Configuring Widgets.

Tk_ConfigureWidget.

Resource Caches.

Tk_Uids.

Other Translators.

Changing Window Attributes.

The Square Configure Procedure.

The Square Widget Command Procedure.

41. Events.

X Events.

File Events.

Timer Events.

Idle Callbacks.

Generic Event Handlers.

Invoking the Event Dispatcher.

42. Displaying Widgets.

Delayed Redisplay.

Double-Buffering with Pixmaps.

Drawing Procedures.

43. Destroying Widgets.

Basics.

Delayed Cleanup.

44. Managing the Selection.

Selection Handlers.

Claiming the Selection.

Retrieving the Selection.

45. Geometry Management.

Requesting a Size for a Widget.

Internal Borders.

Grids.

Geometry Managers.

Claiming Ownership.

Retrieving Geometry Information.

Mapping and Setting Geometry.

Writing Geometry Managers.

Appendix A. Installing Tcl and Tk.

Versions.

The Master Directory.

Retrieving Distributions with FTP.

Retrieving Distributions with Electronic Mail.

Compiling and Installing the Distributions.

Contributed Extensions.

Comp.lang.tcl newsgroup.

Index. 020163337XT04062001

  • 9780321336330
    Tcl and the Tk Toolkit, 2/E
    Ousterhout & Jones
    ©2010 | Addison-Wesley Professional | Paper; 816 pp | Instock
    ISBN-10: 032133633X | ISBN-13: 9780321336330

John K. Ousterhout, a professor in the Department of Electrical Engineering and Computer Science at the University of California at Berkeley, is the creator of Tcl and Tk. In addition to his work on Tcl and Tk, he is leading the development of a network operating system for high-performance workstations. He is a recipient of the ACM Grace Murray Hopper Award, among numerous other honors.



020163337XAB04062001

The Tcl scripting language and the Tk toolkit - a programming environment for creating graphical user interfaces under X Windows - together represent one of the most exciting innovations in X Window System programming. Because Tcl and Tk are so easy to learn, extremely powerful, and contain so many sophisticated features, they have dramatically reduced development time for thousands of X programmers.

Written by the creator of Tcl and Tk, this book is the single authoritative resource for anyone who wants to work with this extraordinary environment. The book offers an introduction and overview of Tcl and Tk and then presents detailed instructions for script writing in Tcl and working with the Tk toolkit.

You will discover how Tk's windowing shell, wish, enables you to develop window-based applications with amazingly few lines of code. You will also find information on Tk's novel and powerful facility for linking applications. Many other features are also described, such as Tk's hypertext and hypergraphics widgets and Tcl's facilities for procedures, list management, and subprocess execution.

For interested readers, the book also describes the C interfaces for Tcl and Tk, showing how to extend their built-in features by writing new C commands.

Upon reading this book, you will learn how to produce far more powerful X Windows System applications in a fraction of the time that used to be required.

"The main guide to Tcl is Tcl and the Tk Toolkit by John Ousterhout (Reading, MA: Addison-Wesley, 1994), the creator of Tcl."
- Unix Review

"The definitive source of information on the system is John Ousterhout's book, Tcl and the Tk Toolkit, published by Addison-Wesley."
- Linux Journal

"Overall, Ousterhout has provided an excellent overview (Tcl and the Tk Toolkit)of a very useful piece of software. If you're thinking of building or customizing a graphical user interface, you won't find many guides better than this."
- IEEE Computer

"This is an extremely well-written book, containing many figures, tables, examples, and scripts to illustrate the Tcl and Tk concepts. His presentation technique and expertise result in a superb text. I enjoyed Tcl and the Tk Toolkit and recommend it highly to anyone with any shell writing experience. Everyone who uses the X Window System will find this book helpful."
- Sys Admin



020163337XB04062001

Pearson Higher Education offers special pricing when you choose to package your text with other student resources. If you're interested in creating a cost-saving package for your students contact your Pearson Higher Education representative.