You are previewing Tcl/Tk in a Nutshell.
O'Reilly logo
Tcl/Tk in a Nutshell

Book Description

The Tcl language and Tk graphical toolkit are simple and powerful building blocks for custom applications. The Tcl/Tk combination is increasingly popular because it lets you produce sophisticated graphical interfaces with a few easy commands, develop and change scripts quickly, and conveniently tie together existing utilities or programming libraries. One of the attractive features of Tcl/Tk is the wide variety of commands, many offering a wealth of options. Most of the things you'd like to do have been anticipated by the language's creator, John Ousterhout, or one of the developers of Tcl/Tk's many powerful extensions. Thus, you'll find that a command or option probably exists to provide just what you need. And that's why it's valuable to have a quick reference that briefly describes every command and option in the core Tcl/Tk distribution as well as the most popular extensions. Keep this book on your desk as you write scripts, and you'll be able to find almost instantly the particular option you need. Most chapters consist of alphabetical listings. Since Tk and mega-widget packages break down commands by widget, the chapters on these topics are organized by widget along with a section of core commands where appropriate. Contents include:

  • Core Tcl and Tk commands and Tk widgets

  • C interface (prototypes)

  • Expect

  • [incr Tcl] and [incr Tk]

  • Tix

  • TclX

  • BLT

  • Oratcl, SybTcl, and Tclodbc

  • Table of Contents

    1. Tcl/Tk in a Nutshell
      1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
      2. Preface
        1. Conventions
        2. Contact O'Reilly & Associates
        3. About This Book
        4. Acknowledgments
      3. 1. Introduction
        1. What Is Tcl?
        2. Structure of This Book
      4. 2. Tcl Core Commands
        1. Overview
        2. Basic Language Features
        3. Command-Line Options
        4. Environment Variables
        5. Special Variables
        6. Backslash Substitutions
        7. Operators and Math Functions
        8. Regular Expressions
        9. Pattern Globbing
        10. Predefined I/O Channel Identifiers
        11. Group Listing of Commands
          1. Control Statements
          2. File Manipulation
          3. Tcl Interpreter Information
          4. Lists
          5. Arrays
          6. Strings
          7. Input/Output
          8. System Interaction
          9. Command History
          10. Multiple Interpreters
          11. Packages
          12. Miscellaneous Commands
        12. Alphabetical Summary of Commands
          1. after
          2. append
          3. array
          4. auto_execok
          5. auto_load
          6. auto_mkindex
          7. auto_reset
          8. bgerror
          9. binary
          10. break
          11. case
          12. catch
          13. cd
          14. clock
          15. close
          16. concat
          17. continue
          18. eof
          19. error
          20. eval
          21. exec
          22. exit
          23. expr
          24. fblocked
          25. fconfigure
          26. fcopy
          27. file
          28. fileevent
          29. flush
          30. for
          31. foreach
          32. format
          33. gets
          34. glob
          35. global
          36. history
          37. if
          38. incr
          39. info
          40. interp
          41. join
          42. lappend
          43. lindex
          44. linsert
          45. list
          46. llength
          47. load
          48. lrange
          49. lreplace
          50. lsearch
          51. lsort
          52. namespace
          53. open
          54. package
          55. pid
          56. pkg_mkIndex
          57. proc
          58. puts
          59. pwd
          60. read
          61. regexp
          62. regsub
          63. rename
          64. return
          65. scan
          66. seek
          67. set
          68. socket
          69. source
          70. split
          71. string
          72. subst
          73. switch
          74. tell
          75. time
          76. trace
          77. unknown
          78. unset
          79. update
          80. uplevel
          81. upvar
          82. variable
          83. vwait
          84. while
      5. 3. Tk Core Commands
        1. Example
        2. Command-Line Options
        3. Environment Variable
        4. Special Variables
        5. Group Listing of Tk Commands
          1. Widgets
          2. Geometry Management
          3. Event Handling
          4. Focus
          5. Dialogs
          6. Miscellaneous
        6. Widget Overview
          1. Standard Widget Options
        7. Widget Commands
          1. button
          2. canvas
          3. checkbutton
          4. entry
          5. frame
          6. label
          7. listbox
          8. menu
          9. menubutton
          10. message
          11. radiobutton
          12. scale
          13. scrollbar
          14. text
          15. toplevel
        8. Utility Commands
          1. bell
          2. bind
          3. bindtags
          4. clipboard
          5. destroy
          6. event
          7. focus
          8. font
          9. grab
          10. grid
          11. image
          12. lower
          13. option
          14. pack
          15. place
          16. raise
          17. selection
          18. send
          19. tk
          20. tkwait
          21. tk_
          22. winfo
          23. wm
      6. 4. The Tcl C Interface
        1. Constants
        2. Data Types
        3. Group Listing of Functions
          1. Tcl Objects
          2. Interpreters and Script Evaluation
          3. Creating New Tcl Commands
          4. Initialization and Packages
          5. Parsing
          6. Exceptions
          7. Accessing Tcl Variables
          8. Hash Tables
          9. String Utilities
          10. POSIX Utilities
          11. Input/Output
          12. Notifier and Events
          13. Miscellaneous
        4. Alphabetical Summary of Functions
      7. 5. The Tk C Interface
        1. Constants
        2. Data Types
        3. Group Listing of Functions
          1. Windows
          2. Configuring Widgets
          3. Bitmaps and Photo Images
          4. Events
          5. Displaying Widgets
          6. Canvases
          7. Text
          8. The Selection
          9. Geometry Management
          10. Application Startup and Initialization
          11. Error Handling
          12. Color
          13. Cursors
          14. Miscellaneous
        4. Alphabetical Summary of Functions
      8. 6. Expect
        1. Overview
        2. Example
        3. Command-Line Options
        4. Environment Variables
        5. Special Variables
        6. Grouped Summary of Commands
          1. Process Interaction
          2. Utility Commands
          3. Synonyms
        7. Alphabetical Summary of Commands
          1. close
          2. debug
          3. disconnect
          4. exit
          5. exp_continue
          6. exp_getpid
          7. exp_internal
          8. exp_open
          9. exp_pid
          10. expect
          11. expect_after
          12. expect_background
          13. expect_before
          14. expect_tty
          15. expect_user
          16. expect_version
          17. fork
          18. inter_return
          19. interact
          20. interpreter
          21. log_file
          22. log_user
          23. match_max
          24. overlay
          25. parity
          26. remove_nulls
          27. send
          28. send_error
          29. send_log
          30. send_tty
          31. send_user
          32. sleep
          33. spawn
          34. strace
          35. stty
          36. system
          37. timestamp
          38. trap
          39. wait
      9. 7. [incr Tcl]
        1. Basic Class Definition
        2. Special Variables
        3. Group Listing of Commands
          1. Classes
          2. Objects
          3. Miscellaneous
        4. Example
        5. Alphabetical Summary of Commands
          1. className
          2. objName
          3. body
          4. class
          5. code
          6. configbody
          7. delete
          8. ensemble
          9. find
          10. itcl_class
          11. itcl_info
          12. local
          13. Scope
      10. 8. [incr Tk]
        1. Basic Structure of a Mega-widget
        2. Special Variable
        3. Methods and Variables
          1. Public Methods
          2. Protected Methods
          3. Protected Variables
        4. Alphabetical Summary of Commands
          1. usual
      11. 9. Tix
        1. Tix Overview
        2. Special Variables
        3. Group Listing of Tix Commands
          1. Mega-widgets
          2. Standard Widgets
          3. Core Commands
        4. Tix Mega-widget Overview
        5. Tix Mega-widgets
          1. Balloon
          2. ButtonBox
          3. CheckList
          4. ComboBox
          5. Control
          6. DialogShell
          7. DirList
          8. DirSelectBox
          9. DirSelectDialog
          10. DirTree
          11. ExFileSelectBox
          12. ExFileSelectDialog
          13. FileComboBox
          14. FileEntry
          15. FileSelectBox
          16. FileSelectDialog
          17. LabelEntry
          18. LabelFrame
          19. LabelWidget
          20. ListNoteBook
          21. Meter
          22. NoteBook
          23. OptionMenu
          24. PanedWindow
          25. PopupMenu
          26. Primitive
          27. ScrolledGrid
          28. ScrolledHList
          29. ScrolledListBox
          30. ScrolledText
          31. ScrolledTList
          32. ScrolledWidget
          33. ScrolledWindow
          34. Select
          35. Shell
          36. StackWindow
          37. StdButtonBox
          38. StdDialogShell
          39. Tree
          40. VStack
          41. VTree
        6. Tix Standard Widgets Overview
          1. Display Items
            1. Image Items
            2. Imagetext Items
            3. Text Items
            4. Window Items
        7. Tix Standard Widgets
          1. Grid
          2. HList
          3. InputOnly
          4. NoteBookFrame
          5. TList
        8. Tix Core Commands
          1. tix
          2. CallMethod
          3. ChainMethod
          4. Class
          5. Descendants
          6. Destroy
          7. DisableAll
          8. DisplayStyle
          9. EnableAll
          10. Form
          11. GetBoolean
          12. GetInt
          13. Mwm
          14. PopGrab
          15. PushGrab
          16. WidgetClass
        9. Tix Extensions to Tk image Command
          1. image
          2. image
      12. 10. TclX
        1. Special Variables
        2. Group Listing of Commands
          1. General Commands
          2. Debugging and Development Commands
          3. Unix Access Commands
          4. File Commands
          5. File Scanning Commands
          6. Math Commands
          7. List Manipulation Commands
          8. Keyed List Commands
          9. String and Character Manipulation Commands
          10. XPG/3 Message Catalog Commands
          11. Help Commands
          12. Library and Package Commands
        3. Alphabetical Summary of Commands
          1. abs
          2. acos
          3. alarm
          4. apropos
          5. asin
          6. atan
          7. atan2
          8. auto_commands
          9. auto_load_file
          10. auto_packages
          11. bsearch
          12. buildpackageindex
          13. catclose
          14. catgets
          15. catopen
          16. ccollate
          17. cconcat
          18. ceil
          19. cequal
          20. chgrp
          21. chmod
          22. chown
          23. chroot
          24. cindex
          25. clength
          26. cmdtrace
          27. commandloop
          28. convert_lib
          29. cos
          30. cosh
          31. crange
          32. csubstr
          33. ctoken
          34. ctype
          35. dirs
          36. double
          37. dup
          38. echo
          39. edprocs
          40. execl
          41. exp
          42. fcntl
          43. flock
          44. floor
          45. fmod
          46. for_array_keys
          47. for_file
          48. for_recursive_glob
          49. fork
          50. fstat
          51. ftruncate
          52. funlock
          53. help
          54. helpcd
          55. helppwd
          56. host_info
          57. hypot
          58. id
          59. infox
          60. int
          61. intersect
          62. intersect3
          63. keyldel
          64. keylget
          65. keylkeys
          66. keylset
          67. kill
          68. lassign
          69. lcontain
          70. lempty
          71. lgets
          72. link
          73. lmatch
          74. loadlibindex
          75. log
          76. log10
          77. loop
          78. lrmdups
          79. lvarcat
          80. lvarpop
          81. lvarpush
          82. mainloop
          83. max
          84. min
          85. nice
          86. pipe
          87. popd
          88. pow
          89. profile
          90. profrep
          91. pushd
          92. random
          93. read_file
          94. readdir
          95. recursive_glob
          96. replicate
          97. round
          98. saveprocs
          99. scancontext
          100. scanfile
          101. scanmatch
          102. searchpath
          103. select
          104. showproc
          105. signal
          106. sin
          107. sinh
          108. sleep
          109. sqrt
          110. sync
          111. system
          112. tan
          113. tanh
          114. tclx_errorHandler
          115. times
          116. translit
          117. try_eval
          118. umask
          119. union
          120. wait
          121. write_file
      13. 11. BLT
        1. Environment Variable
        2. Special Variables
        3. Group Listing of Commands
          1. Graphical Commands
          2. Numerical Data Commands
          3. Tile Widget Commands
          4. Utility Commands
        4. Alphabetical Summary of Commands
          1. barchart
          2. beep
          3. bgexec
          4. bitmap
          5. bltdebug
          6. busy
          7. container
          8. cutbuffer
          9. drag&drop
          10. graph
          11. hierbox
          12. htext
          13. spline
          14. stripchart
          15. table
          16. tabset
          17. tile
          18. vector
          19. watch
          20. winop
      14. 12. Oratcl
        1. Overview
        2. Example
        3. Environment Variables
        4. Special Variables
        5. Group Listing of Commands
          1. Database Server Setup Commands
          2. Data Manipulation Commands
        6. Alphabetical Summary of Commands
          1. oraautocom
          2. orabindexec
          3. orabreak
          4. oracancel
          5. oraclose
          6. oracols
          7. oracommit
          8. orafetch
          9. oralogoff
          10. oralogon
          11. oraopen
          12. oraplexec
          13. orapoll
          14. orareadlong
          15. oraroll
          16. orasql
          17. orawritelong
      15. 13. Sybtcl
        1. Overview
        2. Example
        3. Environment Variables
        4. Special Variables
        5. Group Listing of Commands
          1. Database Server Setup Commands
          2. Data Manipulation Commands
        6. Alphabetical Summary of Commands
          1. sybcancel
          2. sybclose
          3. sybcols
          4. sybconnect
          5. sybnext
          6. sybpoll
          7. sybreadtext
          8. sybretval
          9. sybsql
          10. sybuse
          11. sybwritetext
      16. 14. Tclodbc
        1. Overview
        2. Group Listing of Commands
          1. Connection and Configuration Commands
          2. Data Manipulation Commands
          3. Statement Commands
        3. Summary of Commands
          1. database
          2. database-id
          3. statement-id
      17. 15. Hints and Tips for the Tcl Programmer
        1. Think Commands, Not Statements
        2. Comments Are Treated as Commands
        3. A Symbolic Gesture
        4. Lists Are Strings, but Not All Strings Are Lists
        5. Indirect References
        6. Executing Other Programs
        7. When Is a Number Not a Number?
        8. Quoting and More Quoting
        9. Write Once, Run Where?
          1. Filenames and Pathnames
          2. End of Line Conventions
          3. Determining Platform Specifics
          4. Scanning and For matting Binary Data
        10. Common Tk Errors
          1. Global Scope for -variable and -textvariable
          2. The -command String Must Be a Tcl List
          3. Use update to Refresh Widgets and for Event Processing
        11. Use the Source, Luke!
      18. A. Tcl Resources
        1. Web Sites
          1. General
          2. Tcl/Tk Extensions
        2. Usenet Newsgroups
            1. Books
        3. Mailing Lists
      19. Index
      20. About the Authors
      21. Colophon
      22. SPECIAL OFFER: Upgrade this ebook with O’Reilly