0.3. What's in This Book
Here is the breakdown of what we cover in this book:
- Chapter 1, "Hello, Perl/Tk"
The first chapter contains some interesting history about the Tk
module, introductory comments, and the obligatory Hello World
- Chapter 2, "Geometry Management"
Geometry management is probably the most important concept in using
Perl/Tk. It determines how your widgets are drawn on the screen. Four
grid, place, and
form — are covered here. Most of
the examples in the book use pack.
- Chapter 3, "Fonts"
You can easily make effective use of fonts in your Perl/Tk
applications using Font objects. This chapter shows you how to
utilize Fonts and what options are available for changing them.
Several small applications are covered that demonstrate the use of
- Chapter 4, "Button, Checkbutton, and Radiobutton Widgets"
The Button widget is the first we cover, and we supply lots of
details. There are tons of code snippets and screen shots showing
different ways to manipulate the Button widget. Many of the options
we discuss are common among the other standard widgets. In addition
to the standard Button widget, we'll look at two derived
variants: the Checkbutton and Radiobutton widgets.
- Chapter 5, "Label and Entry Widgets"
The Label widget is the simplest of all. It is usually used with an
Entry widget, which is why they are included in the same chapter.
Typically, the Entry widget accepts user input, and the Label
identifies the input. Perl/Tk has a special Tk::LabEntry widget that
we'll examine in detail.
- Chapter 6, "The Scrollbar Widget"
Certain widgets in Perl/Tk can be scrolled, which means they can
contain more information than you can see on the screen. Scrollbars
are used to navigate the data inside these widgets. This chapter
tells you how Scrollbars communicate with each widget and how to
create and use them. It also illustrates the
Scrolled method, which automates Scrollbar
- Chapter 7, "The Listbox Widget"
A Listbox widget can contain any sort of data, but it usually
contains a list of options from which the user can select. In this
chapter, you'll learn how to create a Listbox, fill it with
some items, and change the way the user selects items from the list.
- Chapter 8, "The Text, TextUndo,and ROText Widgets"
The Text widget is a versatile widget you can use for many purposes
besides just displaying text. This chapter covers the different
things you can put inside a Text widget (such as text, images, or
other widgets) and how to get the best use out of them. The derived
TextUndo and ROText (Read-Only Text) widgets are also discussed.
- Chapter 9, "The Canvas Widget"
A Canvas widget can display objects such as circles, rectangles,
text, images, and even other widgets. This chapter covers all the
options and methods available, and shows how to use them.
- Chapter 10, "The Scale Widget"
The Scale widget is great for giving the user a range of numbers from
which to select so that users can't type in numbers out of
range or type in letters accidentally. This chapter includes examples
of the Scale widget and covers all the methods available for setting
it up and using it.
- Chapter 11, "Frame, MainWindow,and Toplevel Widgets"
The Frame and Toplevel widgets are used to organize your other
widgets on the screen to get the look you want. This chapter shows
how you can use Frames and Toplevels in coordination with a geometry
manager (covered in Chapter 2, "Geometry Management") to make your
windows look the way you want them to. We also look closely at the
MainWindow, which is a specialized Toplevel in disguise.
- Chapter 12, "The Menu System"
Once an application gets complex enough, you will need to put a Menu
in it. This chapter shows different ways to create menubars and
pulldown, popup, tearoff, and option menus, and how they can best be
used in an application. We also cover menu virtual events and briefly
examine pie menus.
- Chapter 13, "Miscellaneous Perl/Tk Methods"
There are many methods available for all widgets in Perl/Tk. We cover
them in this chapter and show you how to use them. The two most
important of these methods are configure and
- Chapter 14, "Creating Custom Widgets in Pure Perl/Tk"
Creating custom widgets is sometimes the only answer to a problem.
This chapter covers all the details, including the Tk class
hierarchy, and gives you several examples of composite and derived
mega widgets to examine. You will find details here that appear
nowhere else in the known universe. Featured widgets are Tk::Nil,
Tk::CanvasPlot, Tk::LabOptionmenu, Tk::LCD, Tk::NavListbox,
Tk::Thermometer, Tk::CollapsableFrame, and Tk::MacCopy.
- Chapter 15, "Anatomy of the MainLoop"
This chapter explores the inner workings of Tk's event loop,
including timers, I/O, mouse and keyboard events, bindings, and
callbacks. Featured modules are Proc::Killfam, Tie::Watch, Tk::Trace,
Tk::bindDump, and Tk::waitVariableX. Featured widgets are
Tk::ExecuteCommand, Tk::MacProgressBar, and Tk::Splashscreen.
- Chapter 16, "User Customization"
This chapter describes how to use the comand line and option database
to customize your Perl/Tk application.
- Chapter 17, "Images and Animations"
This chapter covers the various image types and how to use them. We
examine Bitmaps, Pixmaps, Photos, and compound images, and touch on
tile, transparency, and animation issues. Featured widgets are
Tk::Animation, Tk::PhotoRotateSimple, Tk::Thumbnail, and
- Chapter 18, "A Tk Interface Extension Tour"
A detailed look at all the Tix widgets and ways to use them
effectively in Perl/Tk applications, including display items and
- Chapter 19, "Interprocess Communicationwith Pipes and Sockets"
With care, pipes and sockets can coexist with Tk's event loop.
This chapter develops two illustrative client/server programs.
- Chapter 20, "IPC with send"
Tk provides an unusual IPC mechanism that allows Tk programs to send
messages amongst themselves. This chapter describes Perl-Perl,
Tcl-Tcl, and Perl-Tcl intercommunications, and discusses security
considerations. We compute with multiple processes and develop
a Perl plug-in for tclrobots so that Perl and
Tcl Robot Control Programs can do battle. Featured modules include
Tk::Receive and Tk::TclRobots.
- Chapter 21, "C Widget Internals"
This chapter shows how to write, debug, and package a Tk widget
written in C, using the Tk::Square widget as an example.
- Chapter 22, "Perl/Tk and the Web"
LWP is a Perl library for accessing the World Wide Web. This chapter
develops a web client, tkcomics, that displays
our favorite comic strips. It details various nonblocking mechanisms
for both Unix and Win32. Featured modules are LWP::Simple,
LWP::UserAgent, and Tie::Win32MemMap. We then describe the PerlPlus
Netscape plugin, which allows you to embed Perl in Netscape and run
- Chapter 23, "Plethora of pTk Potpourri"
This chapter is a grab-bag of miscellaneous information and simple
widgets such as Adjuster, Balloon, BrowseEntry, ColorEditor, Dialog,
DialogBox, ErrorDialog, LabFrame, NoteBook, Pane, ProgressBar,
chooseColor, getOpenFile, getSaveFile, and messageBox.
- Appendix A, "Installing Perl/Tk"
The Tk module doesn't come with the standard Perl distribution.
This appendix tells you where to download the latest release and
updates, and how to install them.
- Appendix B, "Options and Default Valuesfor Each Widget"
This appendix lists all the options for every widget described in
- Appendix C, "Complete Program Listings"
This appendix includes complete code listings of sample programs that
don't appear in the book proper.