Tcl and the Tk Toolkit, Second Edition 🔍
John Ousterhout, Ken Jones et al Addison-Wesley Professional, Addison-Wesley professional computing series, 2nd ed, United States?, 2009
英语 [en] · PDF · 5.4MB · 2009 · 📘 非小说类图书 · 🚀/lgli/lgrs/nexusstc/zlib · Save
描述
John K. Ousterhout's Definitive Introduction to Tcl/Tk-Now Fully Updated for Tcl/Tk 8.5 Tcl and the Tk Toolkit, Second Edition, is the fastest way for newcomers to master Tcl/Tk and is the most authoritative resource for experienced programmers seeking to gain from Tcl/Tk 8.5's powerful enhancements. Written by Tcl/Tk creator John K. Ousterhout and top Tcl/Tk trainer Ken Jones, this updated volume provides the same extraordinary clarity and careful organization that made the first edition the world's number one Tcl/Tk tutorial. Part I introduces Tcl/Tk through simple scripts that demonstrate its value and offer a flavor of the Tcl/Tk scripting experience. The authors then present detailed, practical guidance on every feature necessary to build effective, efficient production applications-including variables, expressions, strings, lists, dictionaries, control flow, procedures, namespaces, file and directory management, interprocess communication, error and exception handling, creating and using libraries, and more. Part II turns to the Tk extension and Tk 8.5's new themed widgets, showing how to organize sophisticated user interface elements into modern GUI applications for Tcl. Part III presents incomparable coverage of Tcl's C functions, which are used to create new commands and packages and to integrate Tcl with existing C software-thereby leveraging Tcl's simplicity while accessing C libraries or executing performance-intensive tasks. Throughout, the authors illuminate all of Tcl/Tk 8.5's newest, most powerful improvements. You'll learn how to use new Starkits and Starpacks to distribute run-time environments and applications through a single file; how to take full advantage of the new virtual file system support to treat entities such as zip archives and HTTP sites as mountable file systems; and more. From basic syntax to simple Tcl commands, user interface development to C integration, this fully updated classic covers it all. Whether you're using Tcl/Tk to automate system/network administration, streamline testing, control hardware, or even build desktop or Web applications, this is the one Tcl/Tk book you'll always turn to for answers.
备用文件名
lgrsnf/N:\!genesis_files_for_add\_add\ftp2020-10\Pearson eLibrary\-360772783_5c6f9b0105e2c03b933f33d2.pdf
备用文件名
nexusstc/Tcl and the Tk Toolkit/4785fdf9a9bd5ac14aaa10046f372e63.pdf
备用文件名
zlib/Computers/Computer Science/John Ousterhout, Ken Jones et al/Tcl and the Tk Toolkit_9240514.pdf
备选作者
John K. Osterhout, Ken Jones; with contributions by Eric Foster-Johnson ... [et al.]
备选作者
John K. Ousterhout, Jones, Ken
备选作者
Ousterhout, John K;Jones, Ken
备选作者
John K. Ousterhout; Ken Jones
备用出版商
Addison-Wesley Longman, Incorporated
备用出版商
Longman Publishing
备用出版商
Addison Wesley
备用出版商
Adobe Press
备用版本
Addison-Wesley professional computing series, Addison-Wesley professional computing series, 2nd ed., Fully updated., Upper Saddle River, NJ, New Jersey, 2010
备用版本
Pearson Education Limited (US titles), [N.p.], 2009
备用版本
2nd ed., Upper Saddle River, NJ, New Jersey, 2009
备用版本
United States, United States of America
备用版本
2nd ed, Addison Wesley, 2006
备用版本
2nd edition, 2009
元数据中的注释
lg2853992
元数据中的注释
{"edition":"2","isbns":["032133633X","9780321336330"],"last_page":816,"publisher":"Addison-Wesley Professional","series":"Addison-Wesley Professional Computing series"}
元数据中的注释
Includes bibliographical references and index.
元数据中的注释
Includes index.
备用描述
Cover......Page 1
Contents......Page 6
Preface......Page 26
Preface to the First Edition......Page 28
Introduction......Page 32
PART I: The Tcl Language......Page 36
1.1 Getting Started......Page 38
1.2 “Hello, World!” with Tk......Page 41
1.3 Script Files......Page 43
1.4 Variables and Substitutions......Page 46
1.5 Control Structures......Page 47
1.6 On the Tcl Language......Page 49
1.7 Event Bindings......Page 50
1.8 Additional Features of Tcl and Tk......Page 54
2.1 Scripts, Commands, and Words......Page 56
2.2 Evaluating a Command......Page 57
2.3 Variable Substitution......Page 59
2.5 Backslash Substitution......Page 61
2.6 Quoting with Double Quotes......Page 63
2.7 Quoting with Braces......Page 64
2.8 Argument Expansion......Page 65
2.9 Comments......Page 67
2.10 Normal and Exceptional Returns......Page 70
2.11 More on Substitutions......Page 71
3.1 Commands Presented in This Chapter......Page 74
3.3 Tcl’s Internal Storage of Data......Page 76
3.4 Arrays......Page 77
3.5 Variable Substitution......Page 78
3.6 Multidimensional Arrays......Page 80
3.7 Querying the Elements of an Array......Page 81
3.8 The incr and append Commands......Page 82
3.10 Predefined Variables......Page 84
3.11 Preview of Other Variable Facilities......Page 85
4.1 Commands Presented in This Chapter......Page 88
4.2 Numeric Operands......Page 89
4.3 Operators and Precedence......Page 90
4.4 Math Functions......Page 93
4.5 Substitutions......Page 95
4.6 String Manipulation......Page 97
4.8 Types and Conversions......Page 98
4.9 Precision......Page 99
5.1 Commands Presented in This Chapter......Page 100
5.2 Extracting Characters: string index and string range......Page 104
5.4 Simple Searching......Page 105
5.5 String Comparisons......Page 106
5.6 String Replacements......Page 107
5.7 Determining String Types......Page 108
5.8 Generating Strings with format......Page 109
5.9 Parsing Strings with scan......Page 111
5.10 Glob-Style Pattern Matching......Page 113
5.11 Pattern Matching with Regular Expressions......Page 114
5.12 Using Regular Expressions for Substitutions......Page 122
5.13 Character Set Issues......Page 124
5.14 Message Catalogs......Page 126
5.15 Binary Strings......Page 130
6.1 Commands Presented in This Chapter......Page 136
6.2 Basic List Structure and the lindex and llength Commands......Page 138
6.3 Creating Lists: list, concat, and lrepeat......Page 140
6.4 Modifying Lists: lrange, linsert, lreplace, lset, and lappend......Page 141
6.5 Extracting List Elements: lassign......Page 144
6.6 Searching Lists: lsearch......Page 145
6.8 Converting between Strings and Lists: split and join......Page 146
6.9 Creating Commands as Lists......Page 148
Chapter 7 Dictionaries......Page 150
7.1 Commands Presented in This Chapter......Page 151
7.2 Basic Dictionary Structure and the dict get Command......Page 153
7.3 Creating and Updating Dictionaries......Page 155
7.4 Examining Dictionaries: The size, exists, keys, and for Subcommands......Page 157
7.5 Updating Dictionary Values......Page 158
7.6 Working with Nested Dictionaries......Page 161
8.1 Commands Presented in This Chapter......Page 166
8.2 The if Command......Page 167
8.3 The switch Command......Page 168
8.4 Looping Commands: while, for, and foreach......Page 171
8.5 Loop Control: break and continue......Page 173
8.6 The eval Command......Page 174
8.7 Executing from Files: source......Page 175
9.1 Commands Presented in This Chapter......Page 178
9.2 Procedure Basics: proc and return......Page 179
9.4 Defaults and Variable Numbers of Arguments......Page 181
9.5 Call by Reference: upvar......Page 183
9.6 Creating New Control Structures: uplevel......Page 185
9.7 Applying Anonymous Procedures......Page 186
10.1 Commands Presented in This Chapter......Page 190
10.2 Evaluating Tcl Code in a Namespace......Page 193
10.3 Manipulating Qualified Names......Page 196
10.4 Exporting and Importing Namespace Commands......Page 197
10.5 Inspecting Namespaces......Page 198
10.6 Working with Ensemble Commands......Page 199
10.7 Accessing Variables from Other Namespaces......Page 204
10.8 Controlling the Name Resolution Path......Page 205
11.1 Commands Presented in This Chapter......Page 208
11.2 Manipulating File and Directory Names......Page 211
11.4 Listing Directory Contents......Page 214
11.5 Working with Files on Disk......Page 216
11.6 Reading and Writing Files......Page 220
11.7 Virtual File Systems......Page 229
11.8 Errors in System Calls......Page 231
12.1 Commands Presented in This Chapter......Page 232
12.3 Invoking Subprocesses with exec......Page 234
12.4 I/O to and from a Command Pipeline......Page 238
12.5 Configuring Channel Options......Page 239
12.6 Event-Driven Channel Interaction......Page 241
12.7 Process IDs......Page 244
12.9 TCP/IP Socket Communication......Page 245
12.10 Sending Commands to Tcl Programs......Page 249
13.1 Commands Presented in This Chapter......Page 254
13.2 What Happens after an Error?......Page 255
13.4 Trapping Errors with catch......Page 257
13.5 Exceptions in General......Page 258
13.6 Background Errors and bgerror......Page 262
Chapter 14 Creating and Using Tcl Script Libraries......Page 264
14.1 Commands Presented in This Chapter......Page 265
14.3 Using Libraries......Page 267
14.4 Autoloading......Page 268
14.5 Packages......Page 269
14.6 Tcl Modules......Page 274
14.7 Packaging Your Scripts as Starkits......Page 277
15.1 Commands Presented in This Chapter......Page 282
15.2 Time Delays......Page 288
15.3 Time and Date Manipulation......Page 289
15.5 The info Command......Page 294
15.6 Tracing Operations on Simple Variables......Page 299
15.7 Tracing Array Variables......Page 303
15.8 Renaming and Deleting Commands......Page 304
15.9 Tracing Commands......Page 305
15.10 Unknown Commands......Page 307
15.11 Slave Interpreters......Page 309
16.1 Commands Presented in This Chapter......Page 318
16.2 The History List......Page 319
16.4 Re-executing Commands from the History List......Page 320
16.5 Shortcuts Implemented by unknown......Page 321
16.6 Current Event Number: history nextid......Page 322
PART II: Writing Scripts for Tk......Page 324
Chapter 17 An Introduction to Tk......Page 326
17.1 A Brief Introduction to Windowing Systems......Page 327
17.2 Widgets......Page 329
17.3 Applications, Toplevel Widgets, and Screens......Page 331
17.5 Creating and Destroying Widgets......Page 332
17.6 Geometry Managers......Page 333
17.7 Widget Commands......Page 334
17.8 Commands for Interconnection......Page 335
Chapter 18 A Tour of the Tk Widgets......Page 338
18.1 Widget Basics......Page 339
18.2 Frames......Page 341
18.3 Color Options......Page 342
18.4 Toplevels......Page 343
18.5 Labels......Page 344
18.7 Buttons......Page 347
18.8 Listboxes......Page 352
18.9 Scrollbars......Page 353
18.10 Scales......Page 356
18.11 Entries......Page 358
18.12 Menus......Page 362
18.13 Panedwindow......Page 369
18.14 Standard Dialogs......Page 372
18.15 Other Common Options......Page 374
19.1 Comparing Classic and Themed Widgets......Page 378
19.2 Combobox......Page 380
19.3 Notebook......Page 381
19.4 Progressbar......Page 384
19.7 Treeview......Page 385
19.8 Themed Widget States......Page 393
19.9 Themed Widget Styles......Page 395
19.10 Other Standard Themed Widget Options......Page 399
20.1 Commands Presented in This Chapter......Page 402
20.2 The font Command......Page 404
20.3 The image Command......Page 410
Chapter 21 Geometry Managers......Page 420
21.1 Commands Presented in This Chapter......Page 421
21.2 An Overview of Geometry Management......Page 422
21.3 The Gridder......Page 424
21.4 The Packer......Page 431
21.5 Padding......Page 439
21.7 Hierarchical Geometry Management......Page 440
21.8 Widget Stacking Order......Page 442
21.9 Other Geometry Manager Options......Page 443
21.10 Other Geometry Managers in Tk......Page 444
22.1 Commands Presented in This Chapter......Page 448
22.2 Events......Page 449
22.3 An Overview of the bind Command......Page 451
22.4 Event Patterns......Page 452
22.6 Substitutions in Scripts......Page 454
22.7 Conflict Resolution......Page 456
22.8 Event-Binding Hierarchy......Page 457
22.9 When Are Events Processed?......Page 458
22.10 Named Virtual Events......Page 460
22.11 Generating Events......Page 462
22.12 Logical Actions......Page 463
22.13 Other Uses of Bindings......Page 466
23.1 Canvas Basics: Items and Types......Page 468
23.2 Manipulating Items with Identifiers and Tags......Page 471
23.3 Bindings......Page 474
23.4 Canvas Scrolling......Page 479
23.5 PostScript Generation......Page 480
24.1 Text Widget Basics......Page 482
24.2 Text Indices and Marks......Page 485
24.3 Search and Replace......Page 486
24.4 Text Tags......Page 488
24.5 Virtual Events......Page 493
24.6 Embedded Windows......Page 494
24.7 Embedded Images......Page 495
24.8 Undo......Page 497
24.9 Peer Text Widgets......Page 499
Chapter 25 Selection and the Clipboard......Page 502
25.1 Commands Presented in This Chapter......Page 503
25.2 Selections, Retrievals, and Types......Page 504
25.3 Locating and Clearing the Selection......Page 505
25.4 Supplying the Selection with Tcl Scripts......Page 506
25.5 The clipboard Command......Page 508
25.6 Drag and Drop......Page 509
Chapter 26 Window Managers......Page 512
26.1 Commands Presented in This Chapter......Page 513
26.2 Window Sizes......Page 516
26.3 Window Positions......Page 517
26.4 Gridded Windows......Page 518
26.5 Window States......Page 519
26.6 Decorations......Page 520
26.7 Special Handling: Transients, Groups, and Override-Redirect......Page 521
26.8 System-Specific Window Attributes......Page 522
26.9 Dockable Windows......Page 523
26.10 Window Close......Page 524
26.11 Session Management......Page 525
27.1 Commands Presented in This Chapter......Page 526
27.2 Input Focus......Page 528
27.3 Modal Interactions......Page 530
27.4 Custom Dialogs......Page 534
28.1 Commands Presented in This Chapter......Page 540
28.2 The Option Database......Page 541
28.3 Option Database Entries......Page 542
28.4 The RESOURCE_MANAGER Property and .Xdefaults File......Page 543
28.5 Priorities in the Option Database......Page 544
28.6 The option Command......Page 545
28.7 The configure Widget Command......Page 546
28.8 The cget Widget Command......Page 547
29.1 Commands Presented in This Chapter......Page 548
29.3 The update Command......Page 549
29.5 The tk Command......Page 551
29.6 Variables Managed by Tk......Page 552
29.7 Ringing the Bell......Page 553
PART III: Writing Tcl Applications in C......Page 554
Chapter 30 Tcl and C Integration Philosophy......Page 556
30.1 Tcl versus C: Where to Draw the Line......Page 558
30.2 Resource Names—Connecting C Constructs to Tcl......Page 559
30.3 “Action-Oriented” versus “Object-Oriented”......Page 560
30.4 Representing Information......Page 561
31.1 Functions Presented in This Chapter......Page 562
31.2 Interpreters......Page 564
31.3 A Simple Tcl Application......Page 565
31.5 Multiple Interpreters......Page 566
Chapter 32 Tcl Objects......Page 568
32.1 Functions Presented in This Chapter......Page 569
32.3 Numerical Objects......Page 572
32.4 Fetching C Values from Objects......Page 573
32.5 The Dynamic Nature of a Tcl Object......Page 574
32.8 Reference Counting......Page 575
32.9 Shared Objects......Page 576
32.10 New Object Types......Page 577
32.11 Parsing Strings......Page 578
32.12 Memory Allocation......Page 579
33.1 Functions Presented in This Chapter......Page 580
33.2 Evaluating Tcl Code......Page 581
33.3 Dynamically Building Scripts......Page 583
33.4 Tcl Expressions......Page 584
34.1 Functions Presented in This Chapter......Page 586
34.2 Setting Variable Values......Page 588
34.3 Reading Variables......Page 590
34.5 Linking Tcl and C Variables......Page 591
34.6 Setting and Unsetting Variable Traces......Page 593
34.7 Trace Callbacks......Page 594
34.9 Multiple Traces......Page 596
34.10 Unset Callbacks......Page 597
35.1 Functions Presented in This Chapter......Page 598
35.2 Command Functions......Page 601
35.3 Registering Commands......Page 602
35.5 Tcl_AppendResult......Page 604
35.6 Tcl_SetResult and interp->result......Page 605
35.7 clientData and Deletion Callbacks......Page 607
35.8 Deleting Commands......Page 610
35.9 Fetching and Setting Command Parameters......Page 611
35.10 How Tcl Procedures Work......Page 613
35.11 Command Traces......Page 614
36.1 Functions Presented in This Chapter......Page 616
36.2 The Init Function......Page 617
36.3 Packages......Page 618
36.5 Tcl Stubs......Page 619
36.6 The ifconfig Extension......Page 620
37.1 Functions Presented in This Chapter......Page 628
37.2 Adding Tcl to an Application......Page 629
37.3 Initialize Tcl......Page 630
37.4 Creating New Tcl Shells......Page 631
38.1 Functions Presented in This Chapter......Page 634
38.2 Completion Codes......Page 635
38.3 Setting errorCode......Page 638
38.4 Managing the Return Options Dictionary......Page 639
38.5 Adding to the Stack Trace in errorInfo......Page 640
38.6 Tcl_Panic......Page 643
39.1 Functions Presented in This Chapter......Page 646
39.2 Dynamic Strings......Page 652
39.3 String Matching......Page 656
39.4 Regular Expression Matching......Page 657
39.5 Working with Character Encodings......Page 659
39.6 Handling Unicode and UTF-8 Strings......Page 660
39.7 Command Completeness......Page 662
Chapter 40 Hash Tables......Page 664
40.1 Functions Presented in This Chapter......Page 665
40.2 Keys and Values......Page 666
40.3 Creating and Deleting Hash Tables......Page 667
40.4 Creating Entries......Page 668
40.5 Finding Existing Entries......Page 670
40.6 Searching......Page 671
40.7 Deleting Entries......Page 672
40.8 Statistics......Page 673
41.1 Functions Presented in This Chapter......Page 674
41.2 Lists......Page 677
41.3 Dictionaries......Page 679
42.1 Functions Presented in This Chapter......Page 684
42.2 Channel Operations......Page 691
42.3 Registering Channels......Page 693
42.4 Standard Channels......Page 695
42.5 Creating a New Channel Type......Page 696
43.1 Functions Presented in This Chapter......Page 706
43.2 Channel Events......Page 707
43.3 Timer Events......Page 711
43.4 Idle Callbacks......Page 712
43.5 Invoking the Event Dispatcher......Page 713
44.1 Tcl File System Functions......Page 716
44.2 Virtual File Systems......Page 718
45.1 Functions Presented in This Chapter......Page 720
45.2 Processes......Page 722
45.3 Reaping Child Processes......Page 724
45.4 Asynchronous Events......Page 725
45.6 Exiting and Cleanup......Page 728
45.7 Miscellaneous......Page 729
46.1 Functions Presented in This Chapter......Page 730
46.4 Creating Threads......Page 732
46.6 Mutexes......Page 733
46.7 Condition Variables......Page 734
46.8 Miscellaneous......Page 736
47.1 Building Tcl and Tk......Page 738
47.2 The Tcl Extension Architecture (TEA)......Page 742
47.3 Building Embedded Tcl......Page 749
Appendixes......Page 750
A.1 Versions......Page 752
A.3 ActiveTcl......Page 753
A.5 Compiling Tcl/Tk from Source Distributions......Page 754
B.1 Obtaining and Installing Extensions......Page 756
B.2 TkCon Extended Console......Page 759
B.5 Sound Support with Snack......Page 760
B.6 Object-Oriented Tcl......Page 761
B.8 XML Programming......Page 762
B.10 Integrating Tcl and Java......Page 763
B.12 Expect......Page 764
B.13 Extended Tcl......Page 765
C.1 Online Resources......Page 766
C.2 Books......Page 767
Appendix D: Tcl Source Distribution License......Page 770
Index......Page 772
A......Page 773
B......Page 775
C......Page 776
D......Page 780
E......Page 781
F......Page 784
G......Page 786
I......Page 787
L......Page 789
M......Page 791
N......Page 792
P......Page 793
Q......Page 795
R......Page 796
S......Page 797
T......Page 801
U......Page 804
V......Page 805
W......Page 806
Z......Page 808
备用描述
Tcl was born of frustration. In the early 1980s my students and I developed a num-ber of interactive tools at the University of California at Berkeley, mostly for inte-grated circuit design, and we found ourselves spending a lot of time building badcommand 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 spentas little time as possible on the command language and always ended up with a lan-guage that was weak and quirky. Furthermore, the command language for one toolwas never quite right for the next tool, so we ended up building a new bad com-mand 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 com-mand language. If a general-purpose scripting language could be built as a C librarypackage, then perhaps it could be reused for many different purposes in many dif-ferent applications. Of course, the language would need to be extensible so that eachapplication could add its own specific features to the core provided by the library. Inthe 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'€™sannouncement of HyperCard in the fall of 1987. HyperCard generated tremendousexcitement because of the power of the system and the way in which it allowed manydifferent interactive elements to be scripted and work together. However, I was discour-aged. The HyperCard system had obviously taken a large development effort, and itseemed unlikely to me that a small group such as a university research projectcould ever mount such a massive effort. This suggested that we would not be able toparticipate in the development of new forms of interactive software in the future.
备用描述
The Tcl scripting language and the Tk toolkit, a programming environment for creating graphical user interfaces under X Windows together represent one of the most exciting innovations in X Window System programming. Because Tcl and Tk are so easy to learn, extremely powerful, and contain sophisticated features, they have dramatically reduced development time for thousands of X programmers.
Written by the creator of Tcl and Tk, this book is the single authoritative resource for anyone who wants to work with this extraordinary environment. The book offers an introduction and overview of Tcl and Tk and then presents detailed instructions for script writing in Tcl and working with the Tk toolkit.
You will discover how Tk's windowing shell, wish, enables you to develop window-based applications with amazingly few lines of code. You will also find information on Tk's novel and powerful facility for linking applications. Many other features are also described, such as Tk's hypertext and hypergraphics widgets and Tcl's facilities for procedures, list management, and subprocess execution.
For interested readers, the book also describes the C interfaces for Tcl and Tk, showing how to extend their built-in features by writing new C commands. Upon reading this book, you will learn how to produce far more powerful X Windows System applications in a fraction of the time that used to be required.
开源日期
2020-11-29
更多信息……

🚀 快速下载

成为会员以支持书籍、论文等的长期保存。为了感谢您对我们的支持,您将获得高速下载权益。❤️

🐢 低速下载

由可信的合作方提供。 更多信息请参见常见问题解答。 (可能需要验证浏览器——无限次下载!)

所有选项下载的文件都相同,应该可以安全使用。即使这样,从互联网下载文件时始终要小心。例如,确保您的设备更新及时。
  • 对于大文件,我们建议使用下载管理器以防止中断。
    推荐的下载管理器:JDownloader
  • 您将需要一个电子书或 PDF 阅读器来打开文件,具体取决于文件格式。
    推荐的电子书阅读器:Anna的档案在线查看器ReadEraCalibre
  • 使用在线工具进行格式转换。
    推荐的转换工具:CloudConvertPrintFriendly
  • 您可以将 PDF 和 EPUB 文件发送到您的 Kindle 或 Kobo 电子阅读器。
    推荐的工具:亚马逊的“发送到 Kindle”djazz 的“发送到 Kobo/Kindle”
  • 支持作者和图书馆
    ✍️ 如果您喜欢这个并且能够负担得起,请考虑购买原版,或直接支持作者。
    📚 如果您当地的图书馆有这本书,请考虑在那里免费借阅。