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.

9780201634747

Effective Tcl/Tk Programming Writing Better Programs with Tcl and Tk

by ;
  • ISBN13:

    9780201634747

  • ISBN10:

    0201634740

  • Edition: 1st
  • Format: Paperback
  • Copyright: 1997-12-08
  • Publisher: Addison-Wesley Professional

Note: Supplemental materials are not guaranteed with Rental or Used book purchases.

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 Save up to $13.75
  • Buy Used
    $41.24
    Add to Cart Free Shipping Icon Free Shipping

    USUALLY SHIPS IN 2-4 BUSINESS DAYS

Supplemental Materials

What is included with this book?

Summary

You need a graphical user interface, and it needs to run on multiple platforms. You don't have much time, and you're not a wizard with X/Motif, the Win32 GUI, or the Mac GUI. The project seems impossible, but with Tcl/Tk it's simple and fun. The Tcl scripting language and the Tk toolkit create a powerful programming environment for building graphical user interfaces. With two lines of code you can create a simple button; with two hundred lines of code, a desktop calculator; and with a thousand lines of code, an industrial-strength groupware calendar and appointment minder. Your applications run on all of the major platforms: UNIX, Windows 95/NT, and Macintosh. You can even embed your programs in a Web page to make them available online. Mark Harrison and Michael McLennan, two noted Tcl/Tk experts, combine their extensive experience in this practical programming guide. It is ideal for developers who are acquainted with the basics of Tcl/Tk and are now moving on to build real applications. Effective Tcl/Tk Programming shows you how to build Tcl/Tk applications effectively and efficiently through plenty of real-world advice. It clarifies some of the more powerful aspects of Tcl/Tk, such as the packer, the canvas widget, and binding tags. The authors describe valuable design strategies and coding techniques that will make your Tcl/Tk projects successful. You will learn how to: bull; bull;Create interactive displays with the canvas widget bull; Create customized editors with the text widget bull;Create new geometry managers, like tabbed notebooks or paned windows bull;Implement client/server architectures bull; Handle data structures bull; Interface with existing applications bull;Package Tcl/Tk code into reusable libraries bull; Deliver Tcl/Tk applications that are easy to configure and install bull; Embed applications in a Web page bull; Build applications that will run on multiple platforms Throughout the book, the authors develop numerous applications and a library of reusable components. Learn from their approach, follow their strategies, and steal their code for your own applications! But don't bother retyping all of the examples. 0201634740B04062001

Author Biography

Mark Harrison has been programming in Tcl ever since he heard John Ousterhout speak at the 1990 Usenix conference.* He currently works in the telecommunications industry for DSC Communications Corporation as a senior system architect, where he is Chief Tcl Evangelist.* In addition, he is enrolled in the computer science department at the University of Texas at Dallas.

Michael J. McLennan is a Distinguished Member of Technical Staff at Bell Labs Innovations for Lucent Technologies, where he develops software for Computer-Aided Design (CAD). He has been a Tcl/Tk enthusiast since 1992, writing many extensions and applications. He developed the incr Tcl extension, which adds object-oriented facilities to Tcl/Tk. He has also created several Tcl/Tk training courses.



0201634740AB04062001

Table of Contents

Preface xiii
Chapter 1 Building Tcl/Tk Applications
1(14)
1.1 Application-building process
1(2)
1.2 A small application
3(12)
1.2.1 Designing the application
3(1)
1.2.2 Designing the screen
4(1)
1.2.3 Prototyping the screen
5(1)
1.2.4 Library analysis
6(2)
1.2.5 Adding behavior to the program
8(2)
1.2.6 Adding finishing touches
10(1)
1.2.7 Testing the program
11(2)
1.2.8 Packaging the program
13(2)
Chapter 2 Packing, Gridding, and Placing Windows
15(40)
2.1 Using the pack command
16(21)
2.1.1 Cavity-based model
16(1)
2.1.2 Packing options
17(3)
2.1.3 Packing order
20(1)
2.1.4 Hierarchical packing
20(4)
2.1.5 Compressing windows
24(2)
2.1.6 Enlarging windows
26(4)
2.1.7 Unpacking widgets
30(7)
2.2 Using the grid command
37(10)
2.2.1 Grid-based model
37(1)
2.2.2 Gridding options
38(4)
2.2.3 Resizing windows
42(2)
2.2.4 Mixing grid and pack
44(3)
2.3 Using the place command
47(8)
2.3.1 Coordinate-based model
47(1)
2.3.2 Custom geometry managers
48(7)
Chapter 3 Handling Events
55(54)
3.1 The event loop
55(13)
3.1.1 Keyboard focus
57(1)
3.1.2 Forcing updates
58(2)
3.1.3 Handling long-running bindings
60(6)
3.1.4 Execution scope
66(1)
3.1.5 Quoting and the event loop
66(2)
3.2 Simple examples using bind
68(3)
3.2.1 Selecting an item from a listbox
69(1)
3.2.2 Automatic button help
69(2)
3.2.3 Class bindings
71(1)
3.3 Syntax of the bind command
71(10)
3.3.1 The event specification
72(7)
3.3.2 Percent substitutions
79(2)
3.4 More complex events
81(7)
3.4.1 Click, drag, drop
81(4)
3.4.2 Customizing widget behavior
85(3)
3.5 Binding tags
88(8)
3.5.1 Default binding tags
90(1)
3.5.2 Using break to interrupt event processing
90(1)
3.5.3 Inventing binding tags for groups of bindings
91(3)
3.5.4 Binding to a top-level window
94(2)
3.6 Debugging bindings
96(3)
3.6.1 Displaying bindings
96(1)
3.6.2 Monitoring events
97(2)
3.7 Animation
99(10)
3.7.1 Animating items on a canvas
100(2)
3.7.2 Debugging after events
102(2)
3.7.3 Library procedures for animation
104(5)
Chapter 4 Using the Canvas Widget
109(72)
4.1 Understanding the canvas widget
110(11)
4.1.1 Scrolling
112(2)
4.1.2 Display list model
114(3)
4.1.3 Using tags
117(1)
4.1.4 Canvas bindings
118(3)
4.2 Scrollable form
121(4)
4.3 Progress gauge
125(3)
4.4 HSB color editor
128(7)
4.5 Tabbed notebook
135(7)
4.6 Calendar
142(15)
4.6.1 Handling size changes
142(7)
4.6.2 Sensors and callbacks
149(4)
4.6.3 Monitoring variables
153(4)
4.7 Simple drawing package
157(24)
4.7.1 Drawing items
158(2)
4.7.2 Selecting items
160(5)
4.7.3 Moving and deleting items
165(1)
4.7.4 Configuring items
166(2)
4.7.5 Resizing items
168(1)
4.7.6 Entering text
169(3)
4.7.7 Printing a drawing
172(1)
4.7.8 Saving a drawing
173(5)
4.7.9 Loading a drawing
178(3)
Chapter 5 Using the Text Widget
181(52)
5.1 Understanding the text widget
182(15)
5.1.1 Indexing model
182(4)
5.1.2 Scrolling
186(1)
5.1.3 Using tags
187(3)
5.1.4 Text bindings
190(3)
5.1.5 Using marks
193(1)
5.1.6 Wrap modes
194(1)
5.1.7 Tab stops
195(2)
5.2 Simple text editor
197(2)
5.3 Read-only text display
199(4)
5.4 Appointment editor
203(14)
5.4.1 Using tags to apply styles
204(7)
5.4.2 Embedded windows
211(2)
5.4.3 Changing text bindings
213(3)
5.4.4 Retrieving appointments
216(1)
5.5 Hierarchical browser
217(16)
5.5.1 Hierarchical data
218(5)
5.5.2 Creating the hierarchical browser
223(3)
5.5.3 Using tags and marks
226(7)
Chapter 6 Top-level Windows
233(30)
6.1 Toplevel widgets
233(2)
6.2 Setting the widget class
235(1)
6.3 Communicating with the window manager
235(3)
6.3.1 Window placement
236(1)
6.3.2 Window size
237(1)
6.4 Simple dialogs
238(4)
6.5 Modal dialogs
242(4)
6.6 Controlling access to dialogs
246(8)
6.6.1 Create/destroy strategy
246(2)
6.6.2 Help from the window manager
248(1)
6.6.3 Show/hide strategy
249(5)
6.7 Unmanaged windows
254(9)
6.7.1 Introductory placard
254(2)
6.7.2 Balloon help
256(7)
Chapter 7 Interacting with Other Programs
263(54)
7.1 Executing other programs
263(5)
7.1.1 Execution pipelines
265(1)
7.1.2 Building commands and handling errors
266(2)
7.2 Collecting output from long-running programs
268(3)
7.3 Driving other programs without temporary files
271(2)
7.4 Working around buffering problems
273(3)
7.4.1 Seeing the problem
273(1)
7.4.2 Fixing the problem
274(2)
7.5 Bidirectional pipes
276(3)
7.5.1 Buffering problems
276(1)
7.5.2 Writing and reading
277(1)
7.5.3 Graphical interface
278(1)
7.6 Client server architectures
279(23)
7.6.1 Advantages
279(1)
7.6.2 Disadvantages
280(1)
7.6.3 A simple server
281(2)
7.6.4 A simple client
283(2)
7.6.5 Smarter parsing
285(1)
7.6.6 Safer parsing
286(5)
7.6.7 Asynchronous communication
291(9)
7.6.8 Handling multiline requests
300(2)
7.7 Network programming with sockets
302(6)
7.7.1 Overview
303(1)
7.7.2 A networked server
304(2)
7.7.3 A networked client
306(2)
7.8 A case study--the Electric Secretary
308(9)
7.8.1 Downloading appointments from the server
309(2)
7.8.2 Sending an appointment to the server
311(1)
7.8.3 Handling schedule conflicts
312(1)
7.8.4 Preferences
312(3)
7.8.5 Persistent storage
315(1)
7.8.6 Conclusions
315(2)
Chapter 8 Delivering Tcl/Tk Applications
317(48)
8.1 Adding polish to your application
318(12)
8.1.1 Handling widget resources
318(6)
8.1.2 Handling unexpected errors
324(3)
8.1.3 Animated placard
327(3)
8.2 Creating Tcl/Tk libraries
330(16)
8.2.1 Designing library components
330(4)
8.2.2 Synthesizing data structures
334(3)
8.2.3 Adding callbacks to components
337(4)
8.2.4 Autoloading
341(2)
8.2.5 Packages
343(3)
8.3 Desktop applications
346(9)
8.3.1 Creating a distribution
346(2)
8.3.2 Making scripts into executable programs
348(2)
8.3.3 Making a self-installing program
350(5)
8.4 Web-based applications
355(10)
8.4.1 Simple example
355(3)
8.4.2 A few important caveats
358(4)
8.4.3 Security policies
362(3)
Chapter 9 Developing Cross-platform Applications
365(24)
9.1 User interface issues
366(14)
9.1.1 Menu bars
366(2)
9.1.2 Common dialogs
368(6)
9.1.3 Virtual events
374(1)
9.1.4 Fonts
375(4)
9.1.5 Option database
379(1)
9.2 File system issues
380(4)
9.2.1 File names
381(2)
9.2.2 File manipulation
383(1)
9.2.3 End-of-line translations
383(1)
9.3 Program invocation issues
384(3)
9.3.1 Communicating with other programs
384(2)
9.3.2 Environment variables
386(1)
9.4 When all else fails
387(2)
Appendix A Getting Started with Tcl/Tk 389(4)
A.1 Installing on Windows 95 NT 389(1)
A.2 Installing on UNIX 390(2)
A.3 Installing on Macintosh 392(1)
Appendix B Annotated Bibliography 393(2)
Index 395

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

Preface It's easy to get started with Tcl/Tk. Just follow the steps in Appendix A to obtain the wish program and start it up. Then type in a few lines of code, like this: %button .b -text "Hello, World!" -command exit=> .b%pack .b You'll see theHello, World!button appear as soon as you enter the pack command. On Windows 95, it will look like this:You don't have to edit any makefiles or fight with a compiler. You don't need to know everything about the X window system or the Microsoft Foundation Classes. You don't need to wade through pounds of confusing documents to find symbols, such as XA_FONT_NAME . Instead, you type a few lines of Tcl code and immediately see the results.As you learn more about the Tk widgets, you can write lots of simple programs. With a text widget and 100 lines of Tcl code, you can put together a program for sending electronic mail (e-mail) messages. With a canvas widget and 200 lines of Tcl code, you can create a simple drawing editor.A few other Tcl/Tk books will help you get started. John Ousterhout's Tcl and the Tk Toolkit starts with a complete overview of the Tcl language and then goes on to describe each of the Tk widgets. The book even describes how to add new functionality to Tcl/Tk by integrating your own C code into the wish program. Brent Welch's book Practical Programming in Tcl and Tk is another good source of Tcl/Tk code examples.After reading one of the introductory Tcl/Tk books, you will be well acquainted with the nuts and bolts. But you may not have a good understanding of how they fit together to make an application.We wrote this book to pick up where the others leave off. We assume that you understand some of the Tcl language and that you've written a few simple Tcl/Tk programs. If not, you can pick it up as you read along. But instead of explaining the basics, we focus on areas that are commonly misunderstood-such as the pack command, the bind mechanism, and the canvas widget. We not only explain how these things work but also show how you can use them to build powerful applications. We explain how the packer works and then show how you can use it to create a tabbed notebook that displays "pages" of widgets. We explain how binding tags work and then show how you can use them to handle the modes in a drawing editor. We explain how the canvas works and then show how you can use it to build a progress gauge, a color wheel, and a calendar.Along the way, we describe the lessons that we've learned from developing many thousands of lines of Tcl/Tk code. We show you software architectures and programming techniques that will make your Tcl/Tk code easier to maintain. For example, we show how to Create client/server applications Package Tcl/Tk code into libraries of reusable components Use lists and arrays as data structures Handle common quoting problemsAbove all else, we try to present a holistic view of application development. In Chapter 1, we show you how to go about designing an application--from the initial concept to a working prototype to a finished product. Throughout the book, we develop several useful applications: a desktop calculator, a drawing editor, and a daily calendar that will store all of your appointments. In Chapter 8, we show you how to add polish to your finished applications and how to deliver them to customers.In the course of this book, we develop more than two dozen useful components, including a toolbar, a paned window, a balloon help facility, and a confirmation dialog. We provide complete source code for these components in the software that accompanies this book. You can download this software from th

Rewards Program