Home > Store

Practical Programming in Tcl and Tk, 4th Edition

Register your product to gain access to bonus material or receive a coupon.

Practical Programming in Tcl and Tk, 4th Edition

Book

  • Your Price: $55.99
  • List Price: $69.99
  • Usually ships in 24 hours.

About

Features

The classic bestseller on Tcl/Tk -- and the most complete reference -- has been updated to version 8.4!

° Previous edition sold over 20,000 copies domestically — 30,000 worldwide!

° Updated for Tcl/Tk 8.4–comprehensive and accurate coverage of every Tcl and Tk command

° CD-ROM includes all code plus binary distributions of Tcl/Tk, Tcl extentions and tools

Description

  • Copyright 2003
  • Dimensions: 7" x 9-1/4"
  • Pages: 960
  • Edition: 4th
  • Book
  • ISBN-10: 0-13-038560-3
  • ISBN-13: 978-0-13-038560-4

Practical Programming in Tcl/Tk is described as the "bible" for Tcl programmers. It is a guide to the Tcl/Tk programming language and GUI toolkit. This revision includes substantial updates to cover the new version 8.4-giving both an overview of the features, as well as details about every command in the language. The third edition, written on version 8.2, sold over 30,000 copies. Version 8.4 of Tcl - Tool Command Language-provides substantial updates to one of the most popular UNIX scripting languages. The latest release, includes the addition of a virtual filesystem (VFS), many additional programming widgets (spinbox, panedwindow, labelframe),and improved performance of about 20% over 8.3. The book provides a guide to the best ways to use the tooklit. It not only gives accurate details, but includes extensive examples that demonstrate the best way to use the toolkit. The authors are experts that have both developed the technology and used it to solve problems, so they have many valuable insights to relate to the readers.

Downloads

Downloads

Companion Files (430 MB .zip)

Sample Content

Downloadable Sample Chapter

Download the Sample Chapter related to this title.

Table of Contents



List of Examples.


List of Tables.


Preface.

I. Tcl BASICS.

1. Tcl Fundamentals.

Tcl Commands. Hello, World! Variables. Command Substitution. Math Expressions. Backslash Substitution. Grouping with Braces and Double Quotes. Procedures. A Factorial Example. More about Variables. More about Math Expressions. Comments. Substitution and Grouping Summary. Fine Points. Reference.

2. Getting Started.

The source Command. UNIX Tcl Scripts. Windows Start Menu. Macintosh OS 8/9 and ResEdit. The console Command. Command-Line Arguments. Predefined Variables.

3. The Guestbook CGI Application.

A Quick Introduction to HTML. CGI for Dynamic Pages. The guestbook.cgi Script. Defining Forms and Processing Form Data. Handling Errors in CGI Scripts. Next Steps.

4. String Processing in Tcl.

The string Command. The append Command. The format Command. The scan Command. The binary Command. Related Chapters.

5. Tcl Lists.

Tcl Lists. Constructing Lists. Getting List Elements: llength, lindex, and lrange. Modifying Lists: linsert and lreplace. Searching Lists: lsearch. Sorting Lists: lsort. The split Command. The join Command. Related Chapters.

6. Control Structure Commands.

If Then Else. Switch. While. Foreach. For. Break and Continue. Catch. Error. Return.

7. Procedures and Scope.

The proc Command. Changing Command Names with rename. Scope. The global Command. Call by Name Using upvar. Variable Aliases with upvar.

8. Tcl Arrays.

Array Syntax. The array Command. Building Data Structures with Arrays.

9. Working with Files and Programs.

Running Programs with exec. The file Command. Cross-Platform File Naming. Manipulating Files and Directories. File Attributes. Input/Output Command Summary. Opening Files for I/O. Reading and Writing. The Current Directory — cd and pwd. Matching File Names with glob. The exit and pid Commands. Environment Variables. The registry Command.

II. ADVANCED Tcl.

10. Quoting Issues and Eval.

Constructing Code with the list Command. Exploiting the concat inside eval. The uplevel Command. The subst Command.

11. Regular Expressions.

When to Use Regular Expressions. Regular Expression Syntax. Advanced Regular Expressions. Syntax Summary. The regexp Command. The regsub Command. Transforming Data to Program with regsub. Other Commands That Use Regular Expressions.

12. Script Libraries and Packages.

Locating Packages: The auto_path Variable. Using Packages. Summary of Package Loading. The package Command. Libraries Based on the tclIndex File. The unknown Command. Interactive Conveniences. Tcl Shell Library Environment. Coding Style.

13. Reflection and Debugging.

The clock Command. The info Command. Cross-Platform Support. Tracing Variables and Commands. Interactive Command History. Debugging. Tcl Dev Kit. Other Tools. Performance Tuning.

14. Namespaces.

Using Namespaces. Namespace Variables. Command Lookup. Nested Namespaces. Importing and Exporting Procedures. Callbacks and Namespaces. Introspection. The namespace Command. Converting Existing Packages to use Namespaces. [incr Tcl] Object System. xotcl Object System. Notes.

15. Internationalization.

Character Sets and Encodings. Message Catalogs.

16. Event-Driven Programming.

The Tcl Event Loop. The after Command. The fileevent Command. The vwait Command. The fconfigure Command.

17. Socket Programming.

Networking Extensions for Tcl. Client Sockets. Server Sockets. The Echo Service. Fetching a URL with HTTP. The http Package. Basic Authentication.

18. TclHttpd Web Server.

Integrating TclHttpd with Your Application. Domain Handlers. Application Direct URLs. Document Types. HTML + Tcl Templates. Form Handlers. Programming Reference. Standard Application Direct URLs. The TclHttpd Distribution. Server Configuration.

19. Multiple Interpreters and Safe-Tcl.

The interp Command. Creating Interpreters. Safe Interpreters. Command Aliases. Hidden Commands. Substitutions. I/O from Safe Interpreters. The Safe Base. Security Policies.

20. Safe-Tk and the Browser Plugin.

Tk in Child Interpreters. The Browser Plugin. Security Policies and Browser Plugin. Configuring Security Policies.

21. Multi-Threaded Tcl Scripts.

What are Threads? Thread Support in Tcl. Getting Started with the Thread Extension. Sending Messages to Threads. Preserving and Releasing Threads. Error Handling. Shared Resources. Managing I/O Channels. Shared Variables. Mutexes and Condition Variables. Thread Pools. The Thread Package Commands.

22. Tclkit and Starkits.

Getting Started with Tclkit. Virtual File Systems. Using sdx to Bundle Applications. Exploring the Virtual File System in a Starkit. Creating tclhttpd.kit. Creating a Shared Starkit. Metakit. More Ideas.

III. Tk BASICS.

23. Tk Fundamentals.

Hello, World! in Tk. Naming Tk Widgets. Configuring Tk Widgets. Tk Widget Attributes and the Resource Database. Summary of the Tk Commands. Other Widget Sets.

24. Tk by Example.

ExecLog. The Example Browser. A Tcl Shell.

25. The Pack Geometry Manager.

Packing toward a Side. Horizontal and Vertical Stacking. The Cavity Model. Packing Space and Display Space. Resizing and -expand. Anchoring. Packing Order. Choosing the Parent for Packing. Unpacking a Widget. Packer Summary. Window Stacking Order.

26. The Grid Geometry Manager.

A Basic Grid. Spanning Rows and Columns. Row and Column Constraints. The grid Command.

27. The Place Geometry Manager.

place Basics. The Pane Manager. The place Command.

28. The Panedwindow Widget.

Using the Panedwindow. Programming Panedwindow Widgets. Panedwindow Attributes.

29. Binding Commands to Events.

The bind Command. The bindtags Command. Event Syntax. Modifiers. Event Sequences. Virtual Events. Generating Events. Event Summary.

IV. Tk Widgets.

30. Buttons and Menus.

Button Commands and Scope Issues. Buttons Associated with Tcl Variables. Button Attributes. Button Operations. Menus and Menubuttons. Menu Bindings and Events. Manipulating Menus and Menu Entries. Menu Attributes. A Menu by Name Package.

31. The Resource Database.

An Introduction to Resources. Loading Option Database Files. Adding Individual Database Entries. Accessing the Database. User-Defined Buttons. User-Defined Menus.

32. Simple Tk Widgets.

Frames, Labelframes, and Toplevel Windows. The Label Widget. The Message Widget. The Scale Widget. The bell Command.

33. Scrollbars.

Using Scrollbars. The Scrollbar Protocol. The Scrollbar Widget.

34. The Entry and Spinbox Widgets.

Using Entry Widgets. Using Spinbox Widgets. Entry and Spinbox Bindings. Entry and Spinbox Attributes. Programming Entry and Spinbox Widgets.

35. The Listbox Widget.

Using Listboxes. The Listbox Widget. Listbox Bindings and Events. Listbox Attributes.

36. The Text Widget.

Text Indices. Text Marks. Text Tags. The Selection.Tag Bindings. Searching Text. Embedded Widgets. Embedded Images. Looking inside the Text Widget. The Undo Mechanism. Text Bindings and Events. Text Operations. Text Attributes.

37. The Canvas Widget.

Canvas Coordinates. Hello, World! The Min Max Scale Example. Canvas Objects. Canvas Widget and Canvas Object State Options. Canvas Operations. Generating Postscript. Canvas Attributes. Hints.

V. Tk DETAILS.

38. Selections and the Clipboard.

The Selection Model. The selection Command. The clipboard Command. Selection Handlers.

39. Focus, Grabs, and Dialogs.

Standard Dialogs. Custom Dialogs. Animation with the update Command.

40. Tk Widget Attributes.

Configuring Attributes. Size. Borders and Relief. The Focus Highlight. Padding and Anchors.

41. Color, Images, and Cursors.

Colors. Colormaps and Visuals. Bitmaps and Images. The Text Insert Cursor. The Mouse Cursor.

42. Fonts and Text Attributes.

Naming a Font. X Font Names. Font Metrics. The font Command. Text Attributes. Gridding, Resizing, and Geometry. A Font Selection Application.

43. Send.

The send Command. The Sender Script. Communicating Processes. Remote eval through Sockets.

44. Window Managers and Window Information.

The wm Command. The winfo Command. The tk Command.

45. Managing User Preferences.

App-Defaults Files. Defining Preferences. The Preferences User Interface. Managing the Preferences File. Tracing Changes to Preference Variables. Improving the Package.

46. A User Interface to Bindings.

A Pair of Listboxes Working Together. The Editing Interface. Saving and Loading Bindings.

VI. C Programming.

47. C Programming and Tcl.

Basic Concepts. Creating a Loadable Package. A C Command Procedure. The blob Command Example. CONST in the Tcl 8.4 APIs. Strings and Internationalization. Tcl_Main and Tcl_AppInit. The Event Loop. Invoking Scripts from C.

48. Compiling Tcl and Extensions.

Standard Directory Structure. Building Tcl from Source. Using Stub Libraries. Using autoconf. The Sample Extension.

49. Writing a Tk Widget in C.

Initializing the Extension. The Widget Data Structure. The Widget Class Command. The Widget Instance Command Configuring and Reconfiguring Attributes. Specifying Widget Attributes. Displaying the Clock. The Window Event Procedure. Final Cleanup.

50. C Library Overview.

An Overview of the Tcl C Library. An Overview of the Tk C Library.

VII. CHANGES.

51. Tcl 7.4/Tk 4.0.

wish. Obsolete Features. The cget Operation. Input Focus Highlight. Bindings. Scrollbar Interface. pack info. Focus. The send Command. Internal Button Padding. Radiobutton Value. Entry Widget. Menus. Listboxes. No geometry Attribute. Text Widget. Color Attributes. Color Allocation and tk colormodel. Canvas scrollincrement. The Selection. The bell Command.

52. Tcl 7.5/Tk 4.1

Cross-Platform Scripts. The clock Command. The load Command. The package Command. Multiple foreach loop variables. Event Loop Moves from Tk to Tcl. Network Sockets. Multiple Interpreters and Safe-Tcl. The grid Geometry Manager. The Text Widget. The Entry Widget.

53. Tcl 7.6/Tk 4.2.

More file Operations. Virtual Events. Standard Dialogs. New grid Geometry Manager. Macintosh unsupported1 Command.

54. Tcl/Tk 8.0.

The Tcl Compiler. Namespaces. Safe-Tcl. New lsort. tcl_precision Variable. Year 2000 Convention. Http Package. Serial Line I/O. Platform-Independent Fonts. The tk scaling Command. Application Embedding. Native Menus and Menubars. CDE Border Width. Native Buttons and Scrollbars. Images in Text Widgets. No Errors from destroy. grid rowconfigure. The Patch Releases.

55. Tcl/Tk 8.1.

Unicode and Internationalization. Thread Safety. Advanced Regular Expressions. New String Commands. The DDE Extension. Miscellaneous.

56. Tcl/Tk 8.2.

The Trf Patch. Faster String Operations. Empty Array Names. Browser Plugin Compatibility. Finer Control of Windows Serial Port Monitoring. Regular Expression Expanded Syntax Option.

57. Tcl/Tk 8.3.

New File Manipulation Commands and Options. New glob Options. Regular Expression Command Enhancements. Direct Return of scan Matches. Removing Duplicate List Elements with lsort. Deleting Elements from an Array. Enhanced clock Features. Support for Delayed Package Loading in pkg_mkIndex. The Img Patch. The Dash Patch. Other New Tk Features. The Patch Releases.

58. Tcl/Tk 8.4.

64-Bit Support. Additional Filesystem Features and Commands. New and Enhanced List Commands. Array Searching and Statistics. Enhanced Support for Serial Communications. New String Comparison Operators. Command Tracing. Additional Introspection Commands. Other Tcl Changes. New Tk Widgets. Text Widget Undo Mechanism and Other Enhancements. New pack and grid Features. Displaying Both Text and an Image in a Widget. New Button Relief Attributes. Controlling the State of Entries and Listboxes. More Window Manager Interaction. Other Tk Changes.

59. About The CD-ROM.

Technical Support.

Index

Download the Index file related to this title.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020