Tcl/Tk for Dummies®

Alexander L. Francis, Tim Webster

Publisher: IDG, 1997, 357 pages

ISBN: 0-7645-0152-6

Keywords: TCLTk

Last modified: March 20, 2022, 12:05 a.m.

Tcl/Tk and the Tcl plug-ins are the exciting new scripting system from Sun Microsystems, creator of the enormously popular Java programming language. With Tcl/Tk for Dummies®, novice programmers can create simple, user-friendly applications in just a few minutes with a few lines of code.

Tcl/Tk combines the cross-platform flexibility and security of Java with the simplicity of languages like Visual Basic and HyperCard, with some Perl-like text handling thrown in. The Tk toolkit has been widely used by UNIX programmers to create Windows-based applications, and now it's available for Web-page creation. With this book at your side, you'll not only figure out how to pronounce it (tickle-t-k), but also how to use Tcl/Tk like a pro!

Inside, you'll find helpful advice on how to:

  • Add Windows-style applications inside your Web pages
  • Write cross-platform scripts that can run on Windows, Mac OS, and UNIX
  • Create your own animations and games
  • Improve your server's performance by moving CGI functions to the client side
  • Program using a simple, forgiving language
  • Understand more about how applications and computers work
    • Introduction
      • What Is Tcl/Tk and What's the Tcl/Tk Plug-In?
      • Who Are You?
      • What You Need
      • What's on the CD?
      • How to Use this Book
      • How this book is organized
        • Part I: What's Tcl/Tk?
        • Part II: Language Reference
        • Part III: Widget Science
        • Part IV: Tclet Cookbook
        • Part V: The Part of Tens
      • Icons used in this book
      • Now What?
  1. What's Tcl/Tk?
    1. Getting Started
      • Identifying the Development Applications
        • Tcl
        • Tk
        • Mini-applications
          • Writing and drawing
      • Finding Wish
        • The source distribution
        • Packagers (pre-compiled binaries)
        • The Tcl/Tk plug-in
        • Other cool stuff
      • Taking Inventory
        • Wish
        • Tclsh
        • Libraries
        • Documentation
      • Playing It Safe
        • Security risks on the Internet
        • Vandalism: protecting hard disks
        • Crank calls: arbitrary connections
      • Tcl Sources on the Internet
        • Usenet news groups
        • Web pages
    2. Your Wish Is My Command
      • Getting Your Wish
      • Starting Wish
      • Using Wish
        • Clearing the board
        • Your $2,000 desk calculator
        • Strings and things
        • Fine-tuning widgets
        • A real program
        • A little history
      • Sourcing Files into Wish
      • Quitting Wish
    3. Creating a Tclet Source File
      • Tackling Tclet Source Code with a Text Editor
        • Using a preinstalled text editor
      • Using Automatic Formatting Features
        • Understanding color codes
          • Coloring reserved words
          • Using color to find problems with quote marks
        • Balancing parentheses
      • Following Formatting Conventions
        • Using one command per line
          • Breaking long code into several lines
          • Putting multiple Tcl/Tk commands on a single line
        • Adding comments to your code
        • Indentation and grouping
          • Managing brackets
          • Indenting your Tcl/Tk code
          • Adding horizontal space
    4. Putting Tclets into Web Pages
      • Using the <EMBED> Tag
        • Specifying file paths
        • Setting the tclet's size
      • Setting the Tclet's MIME Type
      • Passing Parameters to the Tclet
        • Parameter-passing syntax
        • Customizing a tclet with parameter information
        • Making an inventory of the tclet's parameters
  2. Language Reference
    1. Basic Building Blocks: Commands and Variables
      • What Are Commands?
        • The anatomy of a command
          • Command names
          • Command options
          • Command arguments
        • Recognizing Tcl/Tk worlds
          • Combinations not found in English (or any human language)
          • Grouped and substituted material
        • Constructing commands
        • Reading the documentation
      • What Are Variables
        • Using scalars to store information
          • Setting and retrieving scalars
          • Changing data types
        • Using associative arrays to store information
    2. The Olde Switcheroo: Substitutions and Grouping
      • Creating Substitutions
        • Performing variable substitution by using the dollar sign
          • Basic syntax
          • Limits on variable substitution
        • Creating command substitutions by using square brackets
      • Grouping Text
        • Grouping text by using curly braces
        • Grouping text by using double quotes
      • Protecting Special Characters with Backslashes
    3. Flow Control: Conditionals and Loops
      • Structuring Your Program
      • Conditionals (Or, If I Only Had a Brain…)
        • Making decisions with if
          • The basic structure of the if command
          • Evaluating the condition
          • Designating the instructions
          • Adding an else clause
          • Adding an elseif clause
        • Streamlining decisions with switch
      • Around and Around and Around You Go: Looping Constructs
        • Simple looping with for
          • Basic construct of the for command
          • The initialization statement
          • The test statement
          • The reinitalization statement
          • The body of the loop
        • Fancy looping with foreach
          • The basic construct
          • The name of the index variable
          • The list
        • Flexible looping with while
        • The basic pattern
        • The test statement
        • the body of the loop
        • Bailing out of a loop
          • Changing your mind with break
          • Skipping a loop with continue
    4. I've Got a Little List!
      • Making a List
      • Moving Information
        • Accessing individual elements
      • Replacing Elements
      • Inserting Elements
    5. Strings 'n' Things
      • Checking out Strings
        • string length
        • string index
        • string first
        • string last
        • string range
      • Comparing Strings
        • string compare
        • string match
      • Creating and Parsing Strings
        • format
        • scan
    6. Procedures and Functions
      • Writing Your Own Commands
        • Streamlining your program
        • Reusing code throughout a tclet
        • Reusing code in new tclets
      • Building a proc Command
        • Arguments for the procedure
        • The body of the procedure
          • The return command
      • Using Global and Local Variables
        • Local variables
        • Global variables
  3. Widget Science
    1. What Is a Widget?
      • Widget Basics
        • A widget is a GUI component
        • A widget is a window
        • A widget is an OOP object
      • Creating and Configuring Widgets
      • The Widget Lineup
        • Toplevels and frames
          • Toplevels
          • Frames
        • Buttons
        • Checkbuttons and radiobuttons
          • Checkbuttons
          • Radiobuttons
        • Label, message, and text widgets
        • Entry widgets
        • Listboxes
        • Scrollbars
        • Scales
        • Canvases
      • Finding Documentation about Widget Options
      • Event Bindings
      • Displaying Widgets
    2. Name, Rank, and Serial Number: Standard Widget Features
      • Sprucing Up with Color
        • background
        • foreground
        • Custom colors
      • Tweaking Size
        • The natural state
        • Adjusting width
        • Specifying height
      • Adding Borders
        • relief
        • borderwidth
      • Using Bitmaps
    3. Binding
      • The -command opttion
        • Review of the -command option
      • The bind Command
        • Widget name
        • Event name
        • Command
    4. Geometry Managers
        • Making a game plan
        • Choosing a geometry manager
        • Mixing geometry managers
        • Using frame widgets
        • Adding Widgets with pack
          • The -side option
          • The -padx and -pady options
          • The -ipadx and -ipady options
          • The -anchor option
          • The -fill option
          • The -expand option
          • The pack configure trick
        • Adding Widgets with grid
          • The -row and -column options
            • Principle 1
            • Principle 2
          • The -rowspan and -columnspan options
          • The -sticky option
  4. Tclet Cookbook
    1. Button, Button, Who's Got My Mutton?
      • Button Features
      • Executing Commands
      • Making Choices
        • Checkbuttons
        • Radiobuttons
    2. Label, Message, and Text Widgets
      • Label Widgets
        • Basic label options
        • Special label options and commands
        • Things to remember about labels
      • Message Widgets
        • Special message options and commands
        • Things to remember about messages
      • Text Widgets
        • Default behavior of text widgets
        • Special text options
        • Character positions in a text widget
        • Indexes
          • Lines and character
          • Coordinates
        • Marks
        • Tags
    3. Canvases (or Painting with Pixels)
      • Creating the Canvas
      • Adding Stuff to the Canvas
        • The coordinate system
        • Rectangles and ovals
        • Arcs
        • Polygons
        • Lines
          • Ends and joints
          • Arrowheads
          • Curved lines
        • Text
        • Other kind of widgets
      • Binding Stuff
      • Moving Stuff
      • Using Other Commands
    4. Making Web Connections
      • What Is HTTP?
      • Things to Remember About the Web
        • Connections can fail
        • Servers can fail
        • Security is an issue
      • Waking up the Web Genie
      • Connecting to a Web Page
        • Understanding the basic game plan
        • Sending the request
      • The Status Array
        • The -progress option
        • The -command option
      • Sending Information Back to a Server
    5. Tcling the Browser
      • Controlling the Browser
        • Creating a frame-based HTML document
        • Writing the HTML to contain the tclet
        • Tclet command: package require Browser
        • Initalizing the variables
        • Creating the tclet's widgets
        • Setting up the bindings
        • Creating the showit procedure
        • Writing the showsource procedure
        • Writing the clearit procedure
      • Talking to the Browser
        • Getting browser information (navinfo.tcl)
        • Writing alerts
        • alarm.tcl
    6. Building a Better Guestbook
      • What Is a Guestbook?
      • Why Use Tcl/Tk to Build a Guestbook?
      • Before You Begin
      • Providing a Better Layout
      • Checking All Entries for Completeness
      • Checking for HTML
      • Filtering out Unwanted Words
      • Bundling the Data
      • Finishing the Guestbook
  5. The Part if Tens
    1. Almost Ten Differences Between Java and Tcl/Tk
      • The Java Virtual Machine
      • Compiling
      • Security
      • Complication
      • Variables
      • Dynamism
      • Objects
      • Multithreading
      • Strings
  • Appendix A: Regular Exprressions
    • Globbing
    • "Real" regular expressions
  • Appendix B: About the CD-ROM

Reviews

Tcl/Tk for Dummies®

Reviewed by Roland Buresund

Decent ****** (6 out of 10)

Last modified: May 21, 2007, 3:25 a.m.

A decent introduction to the language(s).

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required