Chapter 34. Getting Started with Perl/Tk

Steve Lidie

Perl/Tk is a marvelous object-oriented Perl extension that provides a comprehensive collection of widgets for spiffy graphical applications. Tk was developed by John K. Ousterhout and adapted and extended for Perl by Nick Ing-Simmons.

Perl/Tk runs on all variants of Unix, Linux, and Windows. The original version ran on X windows, which uses a client/server model. Clients (such as the one you’ll see in this article) communicate with a server that manages the computer’s display, keyboard, and mouse. For every display there is a window manager that provides a consistent “look and feel,” at least at a high level, for all clients sharing the machine’s display. There are many different window managers, but they all provide similar facilities, such as iconifying, moving, and resizing windows, and framing them in decorative borders. You’ll see window manager commands in later columns.

This article contains a gentle introduction to the fundamentals of Perl/Tk, after which it develops a real application step-by-step. (All of the programs in this book are available at

Perl/Tk is available on CPAN, and a FAQ dedicated to it is available at, the repository of Almost Everything Ever Written About Perl/Tk, thoughtfully maintained by Cameron Laird.

Perl/Tk Programming

Perl/Tk programs are written using the object-oriented syntax $object->method, where $object ...

Get Web, Graphics & Perl/Tk Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.