Summary

The combination of Tool Command Language (Tcl) and its X Window System-based graphical toolkit, Tk, is ideal for quickly developing applications with a graphical interface. This chapter introduces Tcl/Tk through simple examples.

In this chapter, you learned the following:

♦ Tcl is an interpreted language with a set of commands you can combine, according to a set of rules. Tcl comes with the Linux distribution on the companion DVD.

♦ You can learn the Tcl syntax and develop Tcl scripts interactively by running the Tcl command interpreter, tclsh, and entering Tcl commands at the tclsh prompt.

♦ Tcl includes built-in commands for most routine tasks, such as reading and writing files, manipulating strings, and running any Linux command. Also, Tcl includes control-flow commands — such as if, for, and while — that enable you to control the sequence of commands the interpreter processes. Finally, you can use Tcl's proc command to write new Tcl commands that use combinations of existing commands.

♦ Tk, the Tcl toolkit, is an extension of Tcl that uses the X Window System to enable you to build graphical user interfaces. Tk provides the three-dimensional

appearance of Motif, but Tk does not require the Motif toolkit or any other X toolkit. Tk is built on Xlib, which is the C-language Application Programming Interface (API) for X.

Tk includes commands for creating many common widgets (user-interface elements), such as buttons, labels, list boxes, and scrollbars. A widget-naming convention specifies the widget hierarchy (the organization of the widgets). To make the graphical interface active, you have to use the bind command to associate Tcl commands with specific keyboard events and mouse events. You can interactively experiment with and create Tk programs by running wish, the windowing shell that can interpret all Tcl and Tk commands.

Was this article helpful?

0 0
Make Money Writing

Make Money Writing

This Report Will Show You How To Make Money By Providing Writing Services To Other Internet Marketers. Learn how to make money by writing the right way. Grab your copy of this report now and learn. Why writing is a great way to earn money. How to compete with cheap writers, even if you charge a lot more money.

Get My Free Ebook


Post a comment