Tcl/Tk : a developer's guide /
Newly updated with over 150 pages of material on the latest Tcl extensions, Tcl/Tk: A Developer's Guide is a unique practical tutorial for professional programmers and beginners alike. Starting with a clear picture of the basics, Tcl/Tk covers the variety of tools in this "Swiss army knife...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Waltham, Mass. :
Elsevier,
2012.
|
Edición: | 3rd ed. |
Colección: | Morgan Kaufmann Series in Software Engineering and Programming.
|
Temas: | |
Acceso en línea: | Texto completo |
Tabla de Contenidos:
- Front Cover
- Tcl/Tk: A Developer's Guide
- Copyright
- Table of Contents
- Foreword
- Preface
- Tcl/Tk: GUI Programming in a Gooey World
- Acknowledgments
- Introduction
- Where to Get More Information
- 1 Tcl/Tk Features
- 1.1 Tcl Overview
- 1.1.1 The Standard Tcl Distribution
- 1.1.2 Documentation
- 1.2 Tcl as a Glue Language
- 1.2.1 Tcl Scripts Compared with UNIX Shell Scripts
- 1.2.2 Tcl Scripts Compared with MS-DOS .bat Files
- 1.3 Tcl as a General-purpose Interpreter
- 1.3.1 Tcl/Tk Compared to Visual Basic
- 1.3.2 Tcl/Tk Compared to Perl
- 1.3.3 Tcl/Tk Compared to Python
- 1.3.4 Tcl/Tk Compared to Java
- 1.4 Tcl as an Extensible Interpreter
- 1.5 Tcl as an Embeddable Interpreter
- 1.6 Tcl as a Rapid Development Tool
- 1.7 GUI-based Programming
- 1.8 Shipping Products
- 1.9 Bottom Line
- 1.10 Problems
- 2 The Mechanics of Using the Tcl and Tk Interpreters
- 2.1 The tclsh and wish Interpreters
- 2.1.1 Starting the tclsh and wish Interpreters
- 2.1.2 Starting tclsh or wish under UNIX
- Errors Caused by Improper Installation
- 2.1.3 Starting tclsh or wish under Microsoft Windows
- 2.1.4 Starting tclsh or wish on the Mac
- Making a Desktop Icon
- 2.1.5 Exiting tclsh or wish
- 2.2 Using tclsh/wish Interactively
- 2.2.1 Tclsh as a Command Shell
- 2.2.2 Tk Console (tkcon)-An Alternative Interactive tclsh/wish Shell
- 2.2.3 Evaluating Scripts Interactively
- 2.3 Evaluating Tcl Script Files
- 2.3.1 The Tcl Script File
- 2.3.2 Evaluating Tcl Script Files
- 2.3.3 Evaluating a Tcl Script File under UNIX
- 2.3.4 Evaluating a Tcl Script File under Microsoft Windows
- Changing File Association on Windows XP and Earlier
- Changing File Association on Windows Vista and Windows 7
- 2.3.5 Evaluating a Tcl Script on the Mac
- 2.4 Bottom Line
- 2.5 Problems
- 3 Introduction to the Tcl Language.
- 3.1 Overview of the Basics
- 3.1.1 Syntax
- 3.1.2 Grouping Words
- 3.1.3 Comments
- 3.1.4 Data Representation
- 3.1.5 Command Results
- 3.1.6 Errors
- 3.2 Command Evaluation and Substitutions
- 3.2.1 Substitution
- 3.2.2 Controlling Substitutions with Quotes, Curly Braces, and the Backslash
- Splitting Lists
- 3.2.3 Steps in Command Evaluation
- 3.3 Data Types
- 3.3.1 Assigning Values to Variables
- 3.3.2 Strings
- 3.3.3 String Processing Commands
- String and Format Command Examples
- 3.3.4 Lists
- 3.3.5 List Processing Commands
- 3.3.6 Dictionaries
- 3.3.7 Associative Arrays
- 3.3.8 Associative Array Commands
- 3.3.9 Binary Data
- 3.3.10 Handles
- 3.4 Arithmetic and Boolean Operations
- 3.4.1 Math Operations
- Trigonometric Functions
- Exponential Functions
- Conversion Functions
- Random Numbers
- 3.4.2 Conditionals
- The if Command
- The switch Command
- 3.4.3 Looping
- The for Command
- The while Command
- The foreach Command
- 3.4.4 Exception Handling in Tcl
- 3.5 Modularization
- 3.5.1 Procedures
- 3.5.2 Loading Code from a Script File
- 3.5.3 Examining the State of the Tcl Interpreter
- 3.6 Bottom Line
- 3.7 Problems
- 4 Navigating the File System, Basic I/O and Sockets
- 4.1 Navigating the File System
- 4.1.1 Constructing File Paths
- 4.2 Properties of File System Items
- 4.3 Removing Files
- 4.4 Input/Output in TCL
- 4.4.1 Output
- 4.4.2 Input
- 4.4.3 Creating a Channel
- 4.4.4 Closing Channels
- 4.5 Sockets
- 4.5.1 Using a Client Socket
- 4.5.2 Controlling Data Flow
- 4.5.3 Server Sockets
- 4.6 Bottom Line
- 4.7 Problems
- 5 Using Strings and Lists
- 5.1 Converting a String into a List
- 5.2 Examining the List with a for Loop
- 5.3 Using the foreach Command
- 5.4 Using string match Instead of string first
- 5.5 Using lsearch
- 5.6 The regexp Command.
- 5.6.1 Regular Expression Matching Rules
- Basic Regular Expression Rules
- 5.6.2 Examples of Regular Expressions
- 5.6.3 Advanced and Extended Regular Expression Rules
- Minimum and Maximum Match
- Internationalization
- Non-ASCII Values
- Character Classes, Collating Elements, and Equivalence Classes
- Tcl Commands Implementing Regular Expressions
- 5.6.4 Back to the Searching URLs
- 5.7 Creating a Procedure
- 5.7.1 The proc Command
- 5.7.2 A findUrl Procedure
- 5.7.3 Variable Scope
- 5.7.4 Global Information Variables
- 5.8 Making a Script
- 5.8.1 The Executable Script
- 5.9 Speed
- 5.9.1 Comparison of Execution Speeds (Linux Celeron @ 2.6 GHz)
- 5.10 Bottom Line
- 5.11 Problems
- 6 Complex Data Structures with Lists, Arrays and Dicts
- 6.1 Using the Tcl List
- 6.1.1 Manipulating Ordered Data with Lists
- 6.1.2 Manipulating Data with Keyed Lists
- 6.2 Using the Dict
- 6.2.1 Grouping Related Values
- 6.3 Using the Associative Array
- 6.4 Trees in Tcl
- 6.5 Tcl and SQL
- 6.5.1 SQL Basics
- 6.5.2 Using tdbc
- Manipulating Data
- 6.5.3 Using Referenced Tables
- Introspection into Databases
- 6.6 Performance
- 6.7 Bottom Line
- 6.8 Problems
- 7 Procedure Techniques
- 7.1 Arguments to Procedures
- 7.1.1 Variable Number of Arguments to a Procedure
- 7.1.2 Default Values for Procedure Arguments
- 7.2 Renaming or Deleting Commands
- 7.3 Getting Information About Procedures
- 7.4 Substitution and Evaluation of Strings
- 7.4.1 Performing Variable Substitution on a String
- 7.4.2 Evaluating a String as a Tcl Command
- 7.5 Working with Global and Local Scopes
- 7.5.1 Global and Local Scope
- 7.6 Making a Tcl Object
- 7.6.1 An Object Example
- 7.7 Bottom Line
- 7.8 Problems
- 8 Namespaces, Packages and Modules
- 8.1 Namespaces and Scoping Rules
- 8.1.1 Namespace Scope
- 8.1.2 Namespace Naming Rules.
- 8.1.3 Accessing Namespace Entities
- 8.1.4 Why Use Namespaces?
- 8.1.5 The namespace and variable Commands
- 8.1.6 Creating and Populating a Namespace
- 8.1.7 Namespace Nesting
- 8.1.8 Namespace Ensembles
- 8.2 Packages
- 8.2.1 How Packages Work
- 8.2.2 Internal Details: Files and Variables Used with Packages
- 8.2.3 Package Commands
- 8.2.4 Version Numbers
- 8.2.5 Package Cookbook
- Creating a Package
- Using a Tcl Package
- 8.3 TCL Modules
- 8.4 Namespaces and Packages
- 8.5 Hanoi with a Stack Namespace and Package
- 8.6 Conventions and Caveats
- 8.7 Bottom Line
- 8.8 Problems
- 9 Basic Object-Oriented Programming in Tcl
- 9.1 Creating a TclOO Class and Object
- 9.1.1 Constructor and Destructor
- 9.1.2 Methods
- Method Naming Convention
- Invoking Methods from Within Methods
- Registering Methods for Callbacks
- 9.1.3 Inheritance
- Method Chaining
- Inheritance
- Single Inheritance
- Multiple Inheritance
- Using Mixins
- Aggregation
- 9.1.4 Filters
- 9.2 Bottom Line
- 9.3 Problems
- 10 Advanced Object-Oriented Programming in Tcl
- 10.1 Modifying Classes and Objects
- 10.1.1 Modifying Classes
- Modifying Methods
- 10.1.2 Modifying Inheritance
- Adding a Superclass
- Mixing in a New Class
- 10.1.3 Modifying Class, Constructor, Variables and Destructor
- 10.1.4 Static Methods and Variables I
- 10.2 Modifying Objects
- 10.2.1 Changing an Object's Class
- 10.2.2 Defining Per-object Mixins
- 10.2.3 Adding a Method to an Object
- 10.3 Examining Classes and Objects
- 10.3.1 Evaluation of Chains
- 10.3.2 Examining Methods
- 10.3.3 Examining Inheritance
- 10.3.4 Getting a List of Base Classes
- 10.4 Examining Objects
- 10.5 Using TclOO with Callbacks
- 10.6 Adding New Functionality to TclOO
- 10.6.1 Static Variables II
- 10.6.2 Static Methods II
- 10.6.3 Aggregated Objects That Modify the Possessor.
- 10.6.4 Objects That Grow and Change
- 10.7 Bottom Line
- 10.8 Problems
- 11 Introduction to Tk Graphics
- 11.1 Creating a Widget
- 11.2 Conventions
- 11.2.1 Widget Naming Conventions
- 11.2.2 Color Naming Conventions
- 11.2.3 Dimension Conventions
- 11.3 Common Options
- 11.4 Determining and Setting Options
- 11.5 The Basic Widgets
- 11.6 Introducing Widgets: label, button, and entry
- 11.6.1 The label Widget
- 11.6.2 The button Widget
- 11.6.3 The entry Widget
- 11.6.4 Using Namespaces or TclOO with Widgets
- Using Namespace Scope with a Widget
- Using TclOO with a Widget
- 11.7 Application Layout: Geometry Managers and Container Widgets
- 11.7.1 Container Widgets: frame, labelframe, panedwindow
- The frame Widget
- The labelframe Widget
- The ttk::notebook Widget
- The panedwindow Widget
- 11.7.2 Widget Layout: place, pack, and grid
- The place Layout Manager
- The pack Layout Manager
- The grid Layout Manager
- Working Together
- 11.8 Selection Widgets: radiobutton, checkbutton, menu, and listbox
- 11.8.1 radiobutton and checkbutton
- radiobutton
- checkbutton
- 11.8.2 Pull-down Menus: menu, menubutton, and Menubars
- Menubars
- 11.8.3 Selection Widgets: listbox
- 11.9 Scrollbar
- 11.9.1 The Basic scrollbar
- 11.9.2 scrollbar Details
- 11.9.3 Intercepting scrollbar Commands
- 11.10 The scale Widget
- 11.11 New Windows
- 11.12 Interacting with the Event Loop
- 11.13 Scheduling the Future: after
- 11.13.1 Canceling the Future
- 11.14 Bottom Line
- 11.15 Problems
- 12 Using the canvas Widget
- 12.1 Overview of the canvas Widget
- 12.1.1 Identifiers and Tags
- 12.1.2 Coordinates
- 12.1.3 Binding
- 12.2 Creating a canvas Widget
- 12.3 Creating Displayable canvas Items
- 12.3.1 The Line Item
- 12.3.2 The Arc Item
- 12.3.3 The Rectangle Item
- 12.3.4 The Oval Item
- 12.3.5 The Polygon Item.