TCL/TK IN A NUTSHELL pptx

456 1.7K 1
TCL/TK IN A NUTSHELL pptx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

TCL /TK IN A NUTSHELL A Desktop Quick Reference ,TITLE.15069 Page 1 Thursday, July 6, 2006 12:05 PM ,TITLE.15069 Page 2 Thursday, July 6, 2006 12:05 PM TCL/TK IN A NUTSHELL A Desktop Quick Reference Paul Raines & Jeff Tranter Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo ,TITLE.15069 Page 3 Thursday, July 6, 2006 12:05 PM Tcl/Tk in a Nutshell by Paul Raines and Jeff Tranter Copyright © 1999 O’Reilly Media, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. Editor: Andy Oram Production Editor: Madeleine Newell Printing History: March 1999: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. The In a Nutshell series designations, Tcl/Tk in a Nutshell, the image of an ibis, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. This book uses RepKover ™ , a durable and flexible lay-flat binding. ISBN: 1-56592-433-9 [M] [3/05]LCP ,COPYRIGHT.25367 Page iv Thursday, June 15, 2006 2:11 PM Ta ble of Contents Preface xi Chapter 1 —Introduction 1 What Is Tcl? 1 Structur e of This Book 2 Chapter 2 —Tcl Core Commands 3 Overview 3 Basic Language Features 4 Command-Line Options 5 Envir onment Variables 5 Special Variables 5 Backslash Substitutions 6 Operators and Math Functions 7 Regular Expressions 9 Patter n Globbing 10 Pr edefined I/O Channel Identifiers 11 Gr oup Listing of Commands 11 Alphabetical Summary of Commands 16 Chapter 3 —Tk Core Commands 47 Example 47 Command-Line Options 49 Envir onment Variable 50 Special Variables 50 vii 11 May 2006 11:02 Gr oup Listing of Tk Commands 50 Widget Overview 52 Widget Commands 56 Utility Commands 101 Chapter 4 —The Tcl C Interface 137 Constants 137 Data Types 138 Gr oup Listing of Functions 140 Alphabetical Summary of Functions 148 Chapter 5 —The Tk C Interface 156 Constants 156 Data Types 157 Gr oup Listing of Functions 158 Alphabetical Summary of Functions 166 Chapter 6 —Expect 174 Overview 174 Example 175 Command-Line Options 175 Envir onment Variables 177 Special Variables 177 Gr ouped Summary of Commands 179 Alphabetical Summary of Commands 181 Chapter 7 —[incr Tcl] 193 Basic Class Definition 193 Special Variables 194 Gr oup Listing of Commands 194 Example 194 Alphabetical Summary of Commands 195 Chapter 8 —[incr Tk] 201 Basic Structure of a Mega-widget 201 Special Variable 202 Methods and Variables 202 Alphabetical Summary of Commands 204 viii 11 May 2006 11:02 Chapter 9 —Tix 205 Tix Overview 205 Special Variables 205 Gr oup Listing of Tix Commands 206 Tix Mega-widget Overview 208 Tix Mega-widgets 208 Tix Standard Widgets Overview 248 Tix Standard Widgets 251 Tix Cor e Commands 267 Tix Extensions to Tk image Command 278 Chapter 10 —TclX 281 Special Variables 281 Gr oup Listing of Commands 282 Alphabetical Summary of Commands 285 Chapter 11 —BLT 314 Envir onment Variable 315 Special Variables 315 Gr oup Listing of Commands 315 Alphabetical Summary of Commands 316 Chapter 12 —Oratc l 388 Overview 388 Example 389 Envir onment Variables 389 Special Variables 389 Gr oup Listing of Commands 391 Alphabetical Summary of Commands 391 Chapter 13 —Sybtc l 396 Overview 396 Example 397 Envir onment Variables 397 Special Variables 397 Gr oup Listing of Commands 399 Alphabetical Summary of Commands 399 ix 11 May 2006 11:02 Chapter 14 —Tclodbc 403 Overview 403 Gr oup Listing of Commands 404 Summary of Commands 405 Chapter 15 —Hints and Tips for the Tcl Programmer 411 Think Commands, Not Statements 412 Comments Are Treated as Commands 414 A Symbolic Gesture 416 Lists Are Strings, but Not All Strings Are Lists 416 Indir ect Refer ences 418 Executing Other Programs 419 When Is a Number Not a Number? 420 Quoting and More Quoting 421 Write Once, Run Where? 422 Common Tk Errors 424 Use the Source, Luke! 426 Appendix —Tc l Resour ces 427 Index 429 x 11 May 2006 11:02 [...]... variable varName The variable need not already exist array array option arrayName [arg ] Provide functions to manipulate array variables array anymore arrayName searchId Return 1 if there are more elements left in an array search, or 0 if all elements have been returned Accepts an array name and a search ID obtained from a previous call to array startsearch array donesearch arrayName searchId Terminate... Terminate an array search Accepts an array name and a search ID obtained from a previous call to array startsearch array exists arrayName Return 1 if an array variable with the given name exists; otherwise, return 0 array get arrayName [ pattern ] Return a list containing pairs of elements consisting of array names and values If pattern is specified, only the elements that match the glob pattern are included;... I/O channel to another interpreter Packages package forget package ifneeded package names package provide package requir e package unknown package vcompare package versions package vsatisfies pkg_mkIndex Remove information about package from interpreter Tell interpreter how to load a package Return list of available packages Indicate that package is present in interpreter Indicate that package is needed... array set arrayName list Set values of array elements The list should consist of pairs of words specifying element names and values Alphabetical Summary of Commands — array 17 array size arrayName Return the number of elements in the array, or 0 if arrayName is not the name of an array array startsearch arrayName Starts an array search, returning an identifier that can be used for subsequent array nextelement,... following math functions: abs(arg) Absolute value of arg acos(arg) Arc cosine of arg asin(arg) Arc sine of arg atan(arg) Arc tangent of arg atan2(x, y) Arc tangent of x/y ceil(arg) Rounds arg up to the nearest integer cos(arg) Cosine of arg cosh(arg) Hyperbolic cosine of arg double(arg) Floating-point value of arg exp(arg) e to the power of arg 8 Chapter 2 – Tcl Core Commands floor(arg) Round arg down... if array exists Return list of array element names and values Return list of array element names Return name of next element during search Set array values Return number of elements in array Initialize array search operation Print array Strings append binary for mat regexp regsub scan string compare string first string index Append values to variable Insert and extract fields from binary strings printf(... single character except newline ˆ Match beginning of string $ Match end of string \c Match character c c Match character c [abc] Match any character in set abc [ˆabc] Match characters not in set abc [a- z] Match range of characters a through z [ a- z] Match characters not in range a through z (regex) Group expressions Pattern Globbing Many Tcl commands, most notably glob, support filename globbing using the... list Create a list Number of elements in list Return sequential range of elements from list Replace elements in list Search list for element Sort elements of list Split a string into a list Arrays array anymore array donesearch array exists array get array names array nextelement array set array size array startsearch parray Return 1 if more array elements left during search Terminate array search Return... Commands Tcl Core Commands commands, the most common use being as arguments to control structure commands such as if and pr oc Basic Language Features ; or newline Statement separator \ Statement continuation if last character in line # Comment (null command) var Simple variable var (index) Associative array variable var (i,j, ) Multidimensional array variable $var Variable substitution (also ${var})... autoloading cache Group Listing of Commands 15 bgerror catch error eval expr global incr load namespace pr oc rename set source time trace unknown unset update uplevel upvar variable vwait Process background errors Evaluate script and trap exceptional returns Generate an error Evaluate a Tcl script Evaluate an expression Access global variables Increment the value of a variable Load machine code and initialize . Tcl interpreter has a simple syntax, making it suitable as an interactive com- mand language and allowing it to be reasonably small and fast. Tcl programs. Features ;ornewline Statement separator Statement continuation if last character in line # Comment (null command) var Simple variable var (index) Associative array

Ngày đăng: 22/03/2014, 17:20

Từ khóa liên quan

Mục lục

  • Table of Contents

  • Preface

    • Conventions

    • Contact O’Reilly & Associates

    • About This Book

    • Acknowledgments

    • Chapter 1. Introduction

      • What Is Tcl?

      • Structure of This Book

      • Chapter 2. Tcl Core Commands

        • Overview

        • Basic Language Features

        • Command-Line Options

        • Environment Variables

        • Special Variables

        • Backslash Substitutions

        • Operators and Math Functions

        • Regular Expressions

        • Pattern Globbing

        • Predefined I/O Channel Identifiers

        • Group Listing of Commands

        • Alphabetical Summary of Commands

        • Chapter 3. Tk Core Commands

          • Example

Tài liệu cùng người dùng

Tài liệu liên quan