did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780201633375

Tcl and the Tk Toolkit

by
  • ISBN13:

    9780201633375

  • ISBN10:

    020163337X

  • Edition: 1st
  • Format: Paperback
  • Copyright: 1994-03-31
  • Publisher: Addison-Wesley Professional
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $54.99

Summary

This book introduces two systems, Tcl and Tk, that together provide a simple and yet powerful programming environment for developing and using windowing applications under the most current release of the X Window System. With these tools, it is possible for novices to create graphical applications, while providing experts with sophisticated features that go far beyond the capabilities of other toolkits. Written by the creator of Tcl and Tk, this book is the definitive guide to these systems. Specifically, you will learn about Tk's hypertext and hypergraphics widgets and Tcl's facilities for procedures, list management, and subprocess execution. And you will discover how Tk's windowing shell, wish, enables you to develop window-based applications with amazingly few lines of code.

Author Biography

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

Table of Contents

Introduction
Introduction
Organization of the Book
Notation
Pronunciation
Versions
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
The TCL Language
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
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
Expressions
Numeric Operands
Operators and Precedence
Math Functions
Substitutions
String Manipulation
Types and Conversions
Precision
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
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
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
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
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
Processes
Invoking Subprocesses with Exec
I/O To and From a Command Pipeline
Process Ids
Environment Variables
Terminating the Tcl Process with Exit
Errors and Exceptions
What Happens after an Error?
Generating Errors from Tcl Scripts
Trapping Errors with Catch
Exceptions in General
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
History
The History List
Specifying Events1
Reexecuting Commands from the History List
Shortcuts Implemented by Unknown
Current Event Number: History Nextid
Writing Scripts for TK
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
A Tour of the Tk Widgets
Frames
Toplevels
Labels
Buttons, Checkbuttons, and Radiobuttons
Messages
Listboxes
Scrollbars
Scales
Entries
Menus and Menubuttons
Other Common Options
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
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
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
The Selection
Selection
Table of Contents provided by Publisher. All Rights Reserved.

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Excerpts

Tcl was born of frustration. In the early 1980s my students and I developed a number of interactive tools at the University of California at Berkeley, mostly for integrated circuit design, and we found ourselves spending a lot of time building bad command languages. Each tool needed to have a command language of some sort, but our main interest was in the tool rather than its command language. We spent as little time as possible on the command language and always ended up with a language that was weak and quirky. Furthermore, the command language for one tool was never quite right for the next tool, so we ended up building a new bad command language for each tool. This became increasingly frustrating.In the fall of 1987 it occurred to me that the solution was to build a reusable command language. If a general-purpose scripting language could be built as a C library package, then perhaps it could be reused for many different purposes in many different applications. Of course, the language would need to be extensible so that each application could add its own specific features to the core provided by the library. In the spring of 1988 I decided to implement such a language, and the result was Tcl.Tk was also born of frustration. The basic idea for Tk arose in response to Apple's announcement of HyperCard in the fall of 1987. HyperCard generated tremendous excitement because of the power of the system and the way in which it allowed many different interactive elements to be scripted and work together. However, I was discouraged. The HyperCard system had obviously taken a large development effort, and it seemed unlikely to me that a small group such as a university research project could ever mount such a massive effort. This suggested that we would not be able to participate in the development of new forms of interactive software in the future.I concluded that the only hope for us was a component approach. Rather than building a new application as a self-contained monolith with hundreds of thousands of lines of code, we needed to find a way to divide applications into many smaller reusable components. Ideally each component would be small enough to be implemented by a small group, and interesting applications could be created by assembling components. In this environment it should be possible to create an exciting new application by developing one new component and then combining it with existing components.The component-based approach requires a powerful and flexible "glue"for assembling the components, and it occurred to me that perhaps a shared scripting language could provide that glue. Out of this thinking grew Tk, an X11 toolkit based on Tcl. Tk allows components to be either individual user-interface controls or entire applications; in either case components can be developed independently and Tcl can be used to assemble the components and communicate between them.I started writing Tcl and Tk as a hobby in my spare time. As other people began to use the systems I found myself spending more and more time on them, to the point where today they occupy almost all of my waking hours and many of my sleeping ones.Tcl and Tk have succeeded beyond my wildest dreams. The Tcl/Tk developer community now numbers in the tens of thousands and there are thousands of Tcl applications in existence or under development. The application areas for Tcl and Tk cover virtually the entire spectrum of graphical and engineering applications, including computer-aided design, software development, testing, instrument control, scientific visualization, and multimedia. Tcl is used by itself in many applications, and Tcl and Tk are used together in many others. Tcl and Tk are being used by hundreds of companies, large and small, as well as universities and research laboratories.One benefit that came as a surprise to me is that it is possible to create interesting graphical user interfaces (GUIs) entirely as Tcl scripts. I had alway

Rewards Program