副标题:无

作   者:

分类号:

ISBN:9781558608023

微信扫一扫,移动浏览光盘

简介

Tcl/Tk (Tool Command Language/Tool Kit) makes it fast and easy to implement any type of application, from games to network analyzers. Tcl/Tk is a full-bodied, mature programming platform used by NASA rocket scientists, Wall Street database experts, Internet designers, and open source programmers around the world. Tcl/Tk's multi-faceted and extensible nature make it ideal for developingend-user GUIs, client/server middleware, Web applications,and more. You can code completely in Tcl, use any of hundreds of extensions, call C or Java subroutines from Tcl/Tk, or use Tcl to glue legacy applications together. Written from a programmer's perspective, Tcl/Tk: A Developer's Guide describes how to use Tcl's standard tools and the unique features that make Tcl/Tk powerful: including graphics widgets, packages, namespaces, and extensions. With this book an experienced programmer will be able to code Tcl in a few hours. In just a few chaptersyou will learn about Tcl features that allow you to isolate and protect your code from being damaged in large applications. You will even learn how to extend the language itself. Tcl/Tk: A Developer's Guide clearly discusses development tools, proven techniques, and existing extensions. It shows how to use Tcl/Tk effectively and provides many code examples. This fully revised new edition is the complete resource for computer professionals, from systems administrators to programmers.It covers versions 7.4 to 8.4 and includes a CD-ROM containing the interpreters, libraries, and tutorials to get you started quickly. Additional materials in the book include case studies and discussions of techniques for theadvanced user. On the CD-ROM *Distributions for Tcl 8.3 and 8.4 for Linux, Solaris, Macintosh, and Windows. *A copy of ActiveTcl from ActiveState. *The latest release ofTclTutor. *How-to's and tutorials as well as copies of allthe tools discussed in the book. *The author's "Tclsh Spot" articles from :login; magazine and the "Real World" Tcl/Tk chapters from the first edition. *Demo copies of commercial development tools from ActiveState and NeatWare. *Many open source Tcl/Tk development tools. *Tcl/Tk design guidelines. *Brings beginners up to speed quickly. *Overview of Tcl development tools, popular extensions, and packages. *Tips, style guidelines, and debugging techniques for the advanced user.

目录

Table Of Contents:
Foreword v
Preface xxv
Introduction xxix

Tcl/Tk Features 1(18)

Tcl Overview 2(4)

The Standard Tcl Distribution 3(3)

Tcl As a Glue Language 6(3)

Tcl Scripts Compared to UNIX Shell Scripts 8(1)

Tcl Scripts Compared to MS-DOS .bat Files 9(1)

Tcl As a General-Purpose Interpreter 9(4)

Tcl/Tk Compared to Visual Basic 10(1)

Tcl/Tk Compared to Perl 11(1)

Tcl/Tk Compared to Python 11(1)

Tcl/Tk Compared to Java 12(1)

Tcl As an Extensible Interpreter 13(1)

Tcl As an Embeddable Interpreter 13(1)

Tcl As a Rapid Development Tool 13(2)

GUI-Based Programming 15(1)

Shipping Products 15(1)

Bottom Line 16(1)

Problems 16(3)

The Mechanics of Using the Tcl and Tk Interpreters 19(18)

The tclsh and wish Interpreters 19(5)

Starting the tclsh and wish Interpreters 20(1)

Starting tclsh or wish Under UNIX 21(1)

Starting tclsh or wish Under Microsoft Windows 22(1)

Starting tclsh or wish on the Mac 23(1)

Exiting tclsh or wish 23(1)

Using tclsh/wish Interactively 24(2)

tclsh As a Command Shell 24(1)

Tk Console (tkcon)--- An Alternative Interactive tclsh/wish Shell 25(1)

Evaluating Scripts Interactively 25(1)

Evaluating Tcl Script Files 26(7)

The Tcl Script File 27(1)

Evaluating Tcl Script Files 28(1)

Evaluating a Tcl Script File Under UNIX 28(1)

Evaluating a Tcl Script File Under Microsoft Windows 29(4)

Evaluating a Tcl Script on the Mac 33(1)

Bottom Line 33(1)

Problems 34(3)

Introduction to the Tcl Language 37(50)

Overview of the Basics 38(5)

Syntax 38(2)

Grouping Words 40(1)

Comments 40(1)

Data Representation 41(1)

Command Results 42(1)

Errors 42(1)

Command Evaluation and Substitutions 43(3)

Substitution 43(1)

Controlling Substitutions with Quotes, Curly Braces, and the Backslash 43(2)

Steps in Command Evaluation 45(1)

Data Types 46(23)

Assigning Values to Variables 46(2)

Strings 48(1)

String Processing Commands 49(7)

Lists 56(1)

List Processing Commands 57(5)

Associative Arrays 62(1)

Associative Array Commands 63(3)

Binary Data 66(3)

Handles 69(1)

Arithmetic and Boolean Operations 69(11)

Math Operations 69(3)

Conditionals 72(5)

Looping 77(3)

Modularization 80(1)

Procedures 80(1)

Bottom Line 81(2)

Problems 83(4)

The File System, Disk I/O, and Sockets 87(26)

Navigating the File System 87(4)

Properties of File System Items 91(3)

Removing Files 94(1)

Input/Output in Tcl 94(6)

Output 95(1)

Input 95(2)

Creating a Channel 97(2)

Closing Channels 99(1)

Sockets 100(8)

Using a Client Socket 100(3)

Controlling Data Flow 103(2)

Server Sockets 105(3)

Bottom Line 108(2)

Problems 110(3)

Using Strings and Lists 113(28)

Converting a String into a List 113(1)

Examining the List with a for Loop 114(3)

Using the foreach Command 117(1)

Using string match Instead of string first 118(1)

Using lsearch 118(2)

The regexp Command 120(9)

Regular Expression Matching Rules 120(2)

Advanced and Extended Regular Expression Rules 122(5)

Back to the Searching URLs 127(2)

Creating a Procedure 129(4)

The proc Command 129(1)

A findUrl Procedure 130(1)

Variable Scope 131(1)

Global Information Variables 132(1)

Making a Script 133(2)

The Executable Script 133(2)

Speed 135(1)

Comparison of Execution Speeds (Tcl 8.3.2, Linux, PIII @ 1GHz) 136(1)

Bottom Line 136(1)

Problems 137(4)

Building Complex Data Structures with Lists and Arrays 141(38)

Using the Tcl List 142(5)

Manipulating Ordered Data with Lists 142(3)

Manipulating Data with Keyed Lists 145(2)

Using the Associative Array 147(2)

Exception Handling and Introspection 149(5)

Exception Handling in Tcl 149(4)

Examining the State of the Tcl Interpreter 153(1)

Loading Code from a Script File 153(1)

Trees in Tcl 154(4)

Tree Library Description 154(1)

Tree Library Naming Conventions 155(3)

Tree Library Implementation 158(11)

Getting the Parts of a Name 158(3)

Creating a New Tree 161(1)

Creating a New Child Node 162(3)

Tree Library As a Container Class 165(3)

Generating Unique Names 168(1)

Using the Tree Library 169(3)

Speed Considerations 172(1)

Bottom Line 173(2)

Problems 175(4)

Procedure Techniques 179(34)

Arguments to Procedures 179(3)

Variable Number of Arguments to a Procedure 180(1)

Default Values for Procedure Arguments 181(1)

Renaming or Deleting Commands 182(2)

Getting Information About Procedures 184(2)

Substitution and Evaluation of Strings 186(3)

Performing Variable Substitution on a String 186(1)

Evaluating a String as a Tcl Command 187(2)

Working with Global and Local Scopes 189(7)

Global and Local Scope 190(6)

Making a Tcl Object 196(12)

An Object Example 197(1)

Creating a Tree Object 198(2)

Defining the Object's Method 200(8)

Bottom Line 208(1)

Problems 209(4)

Namespaces and Packages 213(36)

Namespaces and Scoping Rules 214(14)

Namespace Scope 214(2)

Namespace Naming Rules 216(1)

Accessing Namespace Entities 216(1)

Why Use Namespaces? 217(1)

The namespace and variable Commands 217(5)

Creating and Populating a Namespace 222(2)

Namespace Nesting 224(4)

Packages 228(6)

How Packages Work 229(1)

Internal Details: Files and Variables Used with Packages 229(1)

Package Commands 230(2)

Version Numbers 232(1)

Package Cookbook 233(1)

A Tree Object Package with Namespaces 234(8)

Adding Namespace and Package to tree.tcl 234(2)

The Tree Object in a Namespace 236(4)

Procedures and Namespace Scopes 240(2)

Namespaces and Packages 242(2)

Bottom Line 244(1)

Problems 245(4)

Introduction to Tk Graphics 249(66)

Creating a Widget 250(1)

Conventions 251(1)

Widget Naming Conventions 251(1)

Color Naming Conventions 252(1)

Dimension Conventions 252(1)

Common Options 252(1)

Determining and Setting Options 253(3)

The Basic Widgets 256(1)

Introducing Widgets: label, button, and entry 257(5)

Widget Layout: frame, place, pack, and grid 262(11)

The frame Widget 263(1)

The place Layout Manager 264(1)

The pack Layout Manager 265(6)

The grid Layout Manager 271(1)

Working Together 272(1)

Selection Widgets: radiobutton, checkbutton, menu, and listbox 273(20)

radiobutton and checkbutton 273(4)

Pull-Down Menus: menu, menubutton, and menubars 277(11)

Selection Widgets: listbox 288(5)

Scrollbar 293(9)

The Basic scrollbar 293(3)

scrollbar Details 296(2)

Intercepting scrollbar Commands 298(4)

The scale Widget 302(2)

New Windows 304(1)

Interacting with the Event Loop 305(1)

Scheduling the Future: after 306(4)

Canceling the Future 309(1)

Bottom Line 310(1)

Problems 311(4)

Using the canvas Widget 315(64)

Overview of the canvas Widget 315(2)

Identifiers and Tags 316(1)

Coordinates 316(1)

Binding 316(1)

Creating a canvas Widget 317(1)

Creating Displayable Canvas Items 318(5)

The Line Item 319(1)

The Arc Item 319(1)

The Rectangle Item 320(1)

The Oval Item 320(1)

The Polygon Item 320(1)

The Text Item 321(1)

The Bitmap Item 321(1)

The Image Item 322(1)

An Example 323(1)

More canvas Widget Subcommands 323(15)

Modifying an Item 324(1)

Changing the Display Coordinates of an Item 325(2)

Moving an Item 327(2)

Finding, Raising, and Lowering Items 329(5)

Fonts and Text Items 334(3)

Using a Canvas Larger Than the View 337(1)

The bind and focus Commands 338(7)

The bind Command 338(3)

The canvas Widget bind Subcommand 341(3)

Focus 344(1)

Creating a Widget 345(8)

A Help Balloon: Interacting with the Window Manager 353(10)

The image Object 363(12)

The image Command 363(2)

Bitmap Images 365(1)

Photo Images 366(4)

Revisiting the delayButton Widget 370(5)

Bottom Line 375(1)

Problems 376(3)

The text Widget and htmllib 379(44)

Overview of the text Widget 380(4)

Text Location in the text Widget 380(2)

Tag Overview 382(1)

Mark Overview 383(1)

Image Overview 383(1)

Window Overview 383(1)

Creating a text Widget 384(2)

Text Widget Subcommands 386(20)

Inserting and Deleting Text 387(2)

Searching Text 389(2)

The mark Subcommands 391(3)

Tags 394(8)

Inserting Images and Widgets into a text Widget 402(4)

HTML Display Package 406(12)

Displaying HTML Text 406(2)

Using html_library Callbacks: Loading Images and Hypertext Links 408(6)

Interactive Help with the text Widget and htmllib 414(4)

Bottom Line 418(2)

Problems 420(3)

Tk Megawidgets 423(80)

Standard Dialog Widgets 423(12)

tk_optionMenu 424(1)

tk_chooseColor 425(1)

tk_getOpenFile 426(3)

tk_getSaveFile 429(1)

tk_messageBox 429(2)

tk_dialog 431(1)

tk_popup 432(3)

Megawidget Building Philosophy 435(3)

Display in Application Window or Main Display? 435(1)

Modal Versus Modeless Operation 436(1)

Widget Access Conventions 436(1)

Widget Frames 436(1)

Configuration 437(1)

Access to Subwidgets 437(1)

Following Tk Conventions 438(1)

Functionality That Makes Megawidgets Possible 438(3)

The rename Command 439(1)

The option Command 439(2)

The -class Option 441(1)

Building a Megawidget 441(1)

A Scrolling Listbox Megawidget 442(12)

scrolledListBox Description 442(3)

Using the scrolledLB 445(1)

Implementing the Scrollable ListBox 446(2)

The scrolledLB Code 448(6)

Namespaces and Tk Widgets 454(10)

Creating a Multiple-Language Megawidget 455(9)

Incorporating a Megawidget into a Larger Megawidget 464(9)

Making a Modal Megawidget: The grab and tkwait Commands 473(8)

The grab Command 474(1)

The tkwait Command 475(1)

The Modal Widget Code 476(5)

Automating Megawidget Construction 481(17)

Building Megawidgets from a Skeleton 481(7)

Building Megawidgets from a Configuration File 488(6)

Another Technique for Building Megawidgets 494(4)

Bottom Line 498(1)

Problems 499(4)

Writing a Tcl Extension 503(66)

Functional View of a Tcl Extension 504(16)

Overview 505(1)

Initialize Any Persistent Data Structures 505(1)

Register New Commands with the Interpreter 505(2)

Accept Data from Tcl Interpreter 507(4)

Returning Results 511(4)

Returning Status to the Script 515(1)

Dealing with Persistent Data 516(4)

Building an Extension 520(4)

Structural Overview of an Extension 521(1)

Naming Conventions 521(3)

An Example 524(29)

demoInt.h 526(3)

demoInit.c 529(2)

demoCmd.c 531(7)

demoDemo.c 538(15)

Complex Data 553(11)

Bottom Line 564(3)

Problems 567(2)

Extensions and Packages 569(40)

[incr Tcl] 571(4)

Expect 575(6)

TclX 581(4)

Sybtcl and Oratcl 585(2)

Mysqltcl 587(4)

VSdb Package 591(5)

BWidgets 596(7)

BLT 603(4)

Graphics Extensions: img 607(1)

Bottom Line 608(1)

Programming Tools 609(38)

Code Formatter 611(5)

frink 612(4)

Code Checkers 616(3)

TclCheck 616(1)

ICEM ice_lint 617(1)

procheck 618(1)

Debuggers 619(6)

debug 619(2)

Graphic Debuggers 621(4)

GUI Generators 625(5)

SpecTcl 625(3)

Visual GIPSY 628(2)

Tcl Compilers 630(3)

ICEM Tcl Compiler 631(1)

TclPro procomp 632(1)

Packaging Tools 633(3)

TclPro prowrap 633(1)

freewrap 633(1)

Starkit and Starpack 634(2)

Tcl Extension Generators 636(5)

SWIG 636(3)

CriTcl 639(2)

Integrated Development Environments 641(4)

ASED 641(1)

Komodo 642(1)

MyrmecoX 643(2)

Bottom Line 645(2)

Tips and Techniques 647(26)

Debugging Techniques 647(11)

Examine the Call Stack with the info level Command 647(1)

Examine Variables When Accessed with trace Command 648(2)

Run Script in Interactive Mode 650(1)

Use puts to Print the Value of Variables or Lines to Be Evaluated 651(3)

Extract Portions of Script for Unit Testing 654(1)

Attach a tkcon Session to Application 654(1)

Create a New Window (Using the toplevel Command) to Interact with Your Application 655(3)

Use a Second wish Interpreter for Remote Debugging 658(1)

Tcl As a Glue Language: The exec Command 658(3)

Creating a G-zipped tar Archive Under UNIX 660(1)

Creating a Zip Archive Under Windows 661(1)

Common Mistakes 661(5)

Problems Using the exec Command 662(1)

Calculating the Time: Numbers in Tcl 663(1)

set, lappend, append, and incr Are the Only Tcl Commands That Modify an Argument 664(1)

The incr Command Works Only with Integers 664(1)

The upvar Command Takes a Name, Not a Value 665(1)

Changes to Widgets Do Not Appear Until the Event Loop Is Processed 665(1)

Be Aware of Possible % Sign Reduction 665(1)

Coding Tips and Techniques 666(5)

Use the Interpreter to Parse Input 666(4)

Handling Platform-Specific Code 670(1)

Bottom Line 671(2)

APPENDIX A About the CD-ROM 673(2)

A.1 How Do I Find Those Extra Goodies? 674(1)

APPENDIX B Installing Tcl/Tk Distributions 675(20)

B.1 Installing Tcl/Tk on a Macintosh 675(5)

B.2 Installing Tcl/Tk on MS Windows 680(4)

B.3 Installing Tcl/Tk on UNIX/Linux Systems 684(11)

B.3.1 Installing ActiveTcl 685(4)

B.3.2 Installing Other Compiled Tcl/Tk Distributions 689(1)

B.3.3 Compiling Tcl/Tk 690(2)

B.3.4 Large Systems Installation 692(3)

APPENDIX C Installing Tcl/Tk Extensions 695(16)

C.1 Installing the BLT Extension 695(2)

C.2 Installing the expect Extension 697(1)

C.2.1 Building the expect Extension Under UNIX or Mac OS X 698(1)

C.2.2 Installing the expect Extension Under Windows NT 698(1)

C.3 Installing the Img Extension 698(2)

C.3.1 Installing the img Extension Under MS Windows 699(1)

C.3.2 Building the img Extension Under UNIX 699(1)

C.4 Installing the [incr Tcl] Extension 700(2)

C.4.1 Installing [incr Tcl] on a Macintosh 700(1)

C.4.2 Installing the [incr Tcl] Extension Under MS Windows 701(1)

C.4.3 Installing [incr Tcl] Under UNIX 702(1)

C.4.4 Installing iwidgets 702(1)

C.5 Installing the MySqlTcl Extension 702(1)

C.6 Installing the oratcl Extension 703(2)

C.6.1 Installing the 2.5 oratcl Extension Under MS Windows 703(1)

C.6.2 Installing the 2.5 oratcl Extension Under UNIX 704(1)

C.6.3 Installing the 4.0 oratcl Extension Under MS Windows 704(1)

C.6.4 Installing the 4.0 oratcl Extension Under UNIX 705(1)

C.7 Installing the sybtcl Extension 705(2)

C.7.1 Installing the sybtcl Extension Under MS Windows 706(1)

C.7.2 Installing the sybtcl Extension Under UNIX 706(1)

C.8 Installing the VSdb Package 707(1)

C.9 Installing the TclX Extension 707(2)

C.9.1 Installing the TclX Extension on a Macintosh 707(1)

C.9.2 Installing the TclX Extension Under UNIX 708(1)

C.10 Installing the BWidget Package 709(2)

APPENDIX D Installing Tcl/Tk Applications 711(16)

D.1 Starkit 711(1)

D.1.1 Installing the TclKit 711(1)

D.1.2 More Information 711(1)

D.2 TkCon 712(1)

D.3 frink 712(1)

D.3.1 Installing a Precompiled frink Package 712(1)

D.3.2 Compiling frink Under MS Windows 712(1)

D.3.3 Compiling frink Under UNIX 713(1)

D.4 tclCheck 713(2)

D.4.1 Installing a Precompiled tclCheck Package 714(1)

D.4.2 Compiling tclCheck Under MS Windows 714(1)

D.4.3 Compiling tclCheck Under UNIX 714(1)

D.5 ICEM Lint 715(1)

D.6 TclPro Suite 715(1)

D.6.1 Installing the TclPro Suite on UNIX Platforms 715(1)

D.6.2 Installing the TclPro Suite on MS Windows 715(1)

D.7 Tuba 716(1)

D.7.1 Installing the Tuba Debugger 716(1)

D.8 tcl-debug 716(1)

D.8.1 Compiling tcl-debug Under UNIX 716(1)

D.9 SpecTcl 717(2)

D.9.1 Installing SpecTcl Under MS Windows 717(1)

D.9.2 Installing SpecTcl Under UNIX 718(1)

D.9.3 Installing SpecTcl on a PPC-based Macintosh 718(1)

D.10 Visual GIPSY 719(1)

D.10.1 Installing Visual Gipsy Under MS Windows 719(1)

D.10.2 Installing Visual Gipsy Under UNIX, Linux, Mac OS, and So On 720(1)

D.11 Freewrap 720(2)

D.11.1 Installing Freewrap Under MS Windows 720(1)

D.11.2 Installing Freewrap Under Linux 721(1)

D.11.3 Installing and Compiling Freewrap Under UNIX 721(1)

D.12 CriTcl 722(1)

D.12.1 Installing CriTcl 722(1)

D.13 SWIG 722(2)

D.13.1 Installing SWIG Under MS Windows 722(1)

D.13.2 Installing SWIG Under UNIX 723(1)

D.13.3 Installing SWIG on a Macintosh 723(1)

D.14 megaWidget 724(1)

D.14.1 Unpacking the megaWidget Distribution 724(1)

D.15 ASED 725(1)

D.15.1 Unpacking the ASED Distribution 725(1)

D.16 ActiveState Komodo IDE 725(1)

D.16.1 Installing Komodo Under Windows 725(1)

D.16.2 Installing Komodo Under Linux 725(1)

D.17 Neatware MyrmecoX IDE 726(1)

APPENDIX E Bonus Book and Tutorials 727(4)

E.1 Accessing the Real World Tcl Chapters 727(1)

E.2 Accessing the Tutorials 727(1)

E.2.1 Accessing the Textual and HTML-based Tutorials 728(1)

E.3 TclTutor 728(1)

E.3.1 Installing TclTutor Under MS Windows 728(1)

E.3.2 Installing TclTutor Under UNIX 728(1)

E.3.3 Installing TclTutor on a Macintosh 729(1)

E.4 Accessing the Extra Documentation 729(1)

E.5 Accessing the Extra Articles 730(1)
Index of Commands 731(2)
Index 733

已确认勘误

次印刷

页码 勘误内容 提交人 修订印次

    • 名称
    • 类型
    • 大小

    光盘服务联系方式: 020-38250260    客服QQ:4006604884

    意见反馈

    14:15

    关闭

    云图客服:

    尊敬的用户,您好!您有任何提议或者建议都可以在此提出来,我们会谦虚地接受任何意见。

    或者您是想咨询:

    用户发送的提问,这种方式就需要有位在线客服来回答用户的问题,这种 就属于对话式的,问题是这种提问是否需要用户登录才能提问

    Video Player
    ×
    Audio Player
    ×
    pdf Player
    ×
    Current View

    看过该图书的还喜欢

    some pictures

    解忧杂货店

    东野圭吾 (作者), 李盈春 (译者)

    loading icon