Home > Articles

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

1.8 Additional Features of Tcl and Tk

The examples in this chapter have used almost every aspect of the Tcl language syntax, and they illustrated many features of Tcl and Tk. However, Tcl and Tk contain many other facilities that are not used in this chapter; all of these are described later in the book. Here is a sample of some of the most useful features that haven't been mentioned yet:

  • Arrays, dictionaries, and lists—Tcl provides associative arrays and dictionaries for storing key-value pairs efficiently and lists for managing aggregates of data.
  • More control structures—Tcl provides several additional commands for controlling the flow of execution, such as eval, for, foreach, and switch.
  • String manipulation—Tcl contains a number of commands for manipulating strings, such as measuring their length, regular expression pattern matching and substitution, and format conversion.
  • File access—You can read and write files from Tcl scripts and retrieve directory information and file attributes such as size and creation time.
  • More widgets—Tk contains many widget classes besides those shown here, such as menus, scrollbars, a drawing widget called a canvas, and a text widget that makes it easy to achieve hypertext effects.
  • Access to other windowing features—Tk provides commands for accessing all of the major windowing facilities, such as a command for communicating with the window manager (to set the window's title, for example), a command for retrieving the selection, and a command to manage the input focus.
  • Interapplication communication—Tcl includes the ability to communicate between applications through interprocess pipes and TCP/IP sockets.
  • C interfaces—Tcl provides C library procedures that you can use to define new Tcl commands in C. (Tk provides a library that you can use to create new widget classes and geometry managers in C, but this capability is rarely used and so is not covered in this book.)
  • + Share This
  • 🔖 Save To Your Account