售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Tcl/Tk 8.5 Programming Cookbook
Table of Contents
Copyright
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. The Tcl Shell
Introduction
The Tcl shell
Writing to the Tcl console
Getting ready
How to do it…
How it works…
Mathematical expressions
Tcl expr operands
Mathematical functions
Computing mathematical expressions
Referencing files in Tcl
UNIX (UNIX, Linux and Mac OS X)
Windows
Variables
Basic variable commands
Getting Ready
How to do it…
How it works…
There's more…
Unsetting a variable
Command line arguments
Launching a Tcl script
Getting Ready
How to do it…
How it works…
There's more…
2. Using the Building Blocks Control Constructs
Introduction
Controlling flow with the if statement
How to do it…
How it works…
There's more…
Looping with for
How to do it…
How it works…
Looping with foreach
How to do it…
How it works…
Looping with while
How to do it…
How it works…
Continuing a procedure
How to do it…
How it works…
Breaking out of a procedure
How to do it…
How it works…
Nested looping
How to do it…
How it works…
There's more…
3. Error Handling
Introduction
Using the catch command
Getting ready
How to do it…
How it works…
Using the eval command
Getting ready
How to do it…
How it works…
There's more…
Using the error command
Getting ready
How to do it…
How it works…
Error handling procedure
Getting ready
How to do it…
How it works…
4. Handling String Expressions
Introduction
Appending to a string
How to do it…
How it works…
Formatting a string
How to do it…
How it works…
Matching a regular expression within a string
Getting ready
How to do it…
How it works…
Performing character substitution on a string
How to do it…
How it works…
Parsing a string using conversion specifiers
How to do it…
How it works…
Determining the length of a string
How to do it…
How it works…
Comparing strings
Getting ready
How to do it…
How it works…
Comparing a string of characters
How to do it…
How it works…
Locating the first instance of a character
How to do it…
How it works…
Locating the index of a character
How to do it…
How it works…
Determining the class of a string
How to do it…
How it works…
Locating the last instance of a string
How to do it…
How it works…
Determining the size of a string
How to do it…
How it works…
Replacing values within a string
How to do it…
How it works…
Locating a pattern within a string
How to do it…
How it works…
Returning a range of characters from a string
How to do it…
How it works…
Creating a string of repeated characters
How to do it…
How it works…
Replacing ranges of characters contained within a string
How to do it…
How it works…
Creating a reverse string
Getting ready
How to do it…
How it works…
Converting a string to lowercase
How to do it…
How it works…
Converting a string to title
How to do it…
How it works…
Converting a string to uppercase
How to do it…
How it works…
Trimming a string
How to do it…
How it works…
Trimming leading whitespace
How to do it…
How it works…
Trimming trailing whitespace
How to do it…
How it works…
Locating the word end
How to do it…
How it works…
Locating the word start
How to do it…
How it works…
Performing variable substitution
How to do it…
How it works…
5. Expanding String Functionality Using Lists
Introduction
Creating a list
How to do it…
How it works…
There's more…
Joining two lists
How to do it…
How it works…
There's more…
Joining list elements
How to do it…
How it works…
There's more…
Appending list elements
How to do it…
How it works…
Assigning list elements to variables
How to do it…
How it works…
Retrieving an element from a list
How to do it…
How it works…
Inserting elements into a list
How to do it…
How it works…
Determining the number of elements
How to do it…
How it works…
Getting a list element
How to do it…
How it works…
Repeating elements
How to do it…
How it works…
There's more…
Replacing elements
How to do it…
How it works…
Reversing elements
How to do it…
How it works…
Searching a list
How to do it…
How it works…
Editing a list
How to do it…
How it works…
Sorting a list
How to do it…
How it works…
Splitting a string into a list
How to do it…
How it works…
6. The Tcl Dictionary
Introduction
Creating a dictionary
How to do it…
How it works…
There's more…
Using set with the dict create command
Appending to a dictionary
How to do it…
How it works…
Determining if a key exists
How to do it…
How it works…
Filtering a dictionary
How to do it…
How it works…
There's more…
Searching a dictionary
How to do it…
How it works…
Getting a record
How to do it…
How it works…
Incrementing a value
How to do it…
How it works…
Getting the dictionary structure
How to do it…
How it works…
Getting a list of keys
How to do it…
How it works…
Appending to an existing record
How to do it…
How it works…
Merging two dictionaries
How to do it…
How it works…
Creating a blank dictionary structure
How to do it…
How it works…
Updating variables from a dictionary
How to do it…
How it works…
Determining the size of a dictionary
How to do it…
How it works…
Getting all records
How to do it…
How it works…
Assigning values
How to do it…
7. File Operations
Introduction
Opening a file
How to do it…
How it works…
There's more…
Configuring a file
How to do it…
There's more…
Opening a command pipeline
How to do it…
How it works…
There's more…
Writing a file
How to do it…
How it works…
Reading a file
How to do it…
How it works…
Closing a file
How to do it…
How it works…
File handling
Getting ready
How to do it…
How it works…
8. Tk GUI Programming with Tcl/Tk
Introduction
Creating a widget
How to do it…
How it works…
There's more…
Writing to the console
How to do it…
How it works…
Setting the attributes of the window through window manager
How to do it…
How it works…
Creating an additional window
Standard options:
Window-specific options
Commands
How to do it…
How it works…
Destroying a window
How to do it…
How it works…
There's more…
Creating a custom dialog
How to do it…
How it works…
9. Configuring and Controlling Tk Widgets
Introduction
Creating a frame widget
How to do it…
How it works…
Creating a label widget
How to do it…
How it works…
Creating an entry widget
How to do it…
How it works…
Creating a button widget
How to do it…
How it works…
Creating a listbox widget
How to do it…
How it works…
Creating an image
Getting ready
How to do it…
How it works…
Creating a simple form
How to do it…
How it works…
10. Geometry Management
Introduction
Controlling layout with the pack command
How to do it...
How it works…
Controlling layout with the grid command
How to do it…
How it works…
Combining pack and grid
How to do it…
How it works…
Creating an address book interface
Getting ready
How to do it…
How it works…
11. Using Tcl Built-in Dialog Windows
Introduction
Displaying a message box
How to do it…
How it works…
Displaying a confirmation dialog
How to do it…
How it works…
Displaying the color picker
How to do it…
How it works…
Displaying the directory dialog
How to do it…
How it works…
Displaying the file selection dialog
How to do it…
How it works…
Selecting a directory and file
How to do it…
How it works…
12. Creating and Managing Menus
Introduction
Creating a menu
How to do it…
How it works…
Adding menu buttons
How to do it…
How it works…
Displaying a pop-up menu
How to do it…
How it works…
Data entry application
How to do it…
How it works…
13. Creating the Address Book Application
Introduction
Creating the Address Book application
How to do it…
How it works…
Adding a record
How to do it…
How it works…
Navigating records
How to do it…
How it works…
Deleting a record
How to do it…
How it works…
Finding a record
How to do it…
How it works…
Full listing
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜