Synopses & Reviews
Learning Perl/Tk is a tutorial for Perl/Tk, the extension to Perl for creating graphical user interfaces. With Tk, Perl programs can be window-based rather than command-line based, with buttons, entry fields, listboxes, menus, and scrollbars. Originally developed for the Tcl language, the Perl port of the Tk toolkit liberates Perl programmers from the world of command-line options, STDIN, and STDOUT, allowing them to build graphical, event-driven applications for both Windows and UNIX.This book is aimed at Perl novices and experts alike. It explains the reasoning behind event-driven applications and drills in guidelines on how to best design graphical applications. It teaches how to implement and configure each of the Perl/Tk graphical elements step-by-step. Special attention is given to the geometry managers, which are needed to position each button, menu, label and listbox in the window frame.Although this book does not teach basic Perl, anyone who has written even the simplest Perl program should be able to learn Tk from this book. The writing is breezy and informal, and gets right to the point of what you need to know and why. The book is rife with illustrations that demonstrate how each element is drawn and how its configuration options affect its presentation.Learning Perl/Tk is for every Perl programmer who would like to implement simple, easy-to-use graphical interfaces.
Synopsis
This tutorial for Perl/Tk, the extension to Perl for creatinggraphical user interfaces, shows how to use Perl/Tk to buildgraphical, event-driven applications for both Windows and UNIX.With Tk, Perl programs can be window-based rather than command-linebased, with buttons, entry fields, listboxes, menus, and scrollbars. Anyone who has written even the simplest Perl program should be able to learn Tk from this book. It gets right to the point of what you need to know and why, teaching how to implement and configure each Perl/Tk graphical element. Numerous illustrations demonstrate how each element is drawn and how its configuration options affect itspresentation. "Learning Perl/Tk is for every Perl programmerwho would like to implement simple, easy-to-use graphical interfaces.
Synopsis
This tutorial for Perl/Tk, the extension to Perl for creating graphical user interfaces, shows readers how to use Perl/Tk to build graphical, event-driven applications for both Windows and UNIX. Rife with illustrations, it teaches how to implement and configure each Perl/Tk graphical element.
About the Author
Nancy Walsh has been involved with Perl (and Perl/Tk) since 1996. She received a Computer Science degree from the University of Arizona in 1993, and currently works as a Principal Consultant for XOR, Inc. doing J2EE and Java work on various projects. Nancy has taught several Perl/Tk Tutorials at the O'Reilly Open Source Conference and is also the author of Learning Perl/Tk.
Table of Contents
Preface; What You Should Already Know; What's in This Book; Reading Order; Typographical Conventions; We'd Like to Hear from You; Acknowledgments; Chapter 1: Introduction to Perl/Tk; 1.1 A Bit of History About Perl (and Tk); 1.2 Perl/Tk for Both Unix and Windows 95/NT; 1.3 Why Use a Graphical Interface?; 1.4 Why Use Perl/Tk?; 1.5 Installing the Tk Module; 1.6 Creating Widgets; 1.7 Coding Style; 1.8 Displaying a Widget; 1.9 The Anatomy of an Event Loop; 1.10 Hello World Example; 1.11 Using exit Versus Using destroy; 1.12 Naming Conventions for Widget Types; 1.13 Using print for Diagnostic/Debugging Purposes; 1.14 Designing Your Windows (A Short Lecture); Chapter 2: Geometry Management; 2.1 Pack; 2.2 Grid; 2.3 Place; 2.4 Geometry Management Summary; Chapter 3: The Basic Button; 3.1 The Button Widget; 3.2 Some Fun Things to Try; Chapter 4: Checkbuttons and Radiobuttons; 4.1 The Checkbutton Widget; 4.2 The Radiobutton Widget; 4.3 Fun Things to Try; Chapter 5: Label and Entry Widgets; 5.1 The Label Widget; 5.2 The Entry Widget; 5.3 Fun Things to Try; Chapter 6: Scrollbars; 6.1 Defining Scrollbar Parts; 6.2 The Scrolled Method; 6.3 The Scrollbar Widget; 6.4 Examples; 6.5 Fun Things to Try; Chapter 7: The Listbox Widget; 7.1 Creating and Filling a Listbox; 7.2 Listbox Options; 7.3 Selection Modes; 7.4 Colors; 7.5 Listbox Style; 7.6 Configuring a Listbox; 7.7 Inserting Items; 7.8 Deleting Items; 7.9 Retrieving Elements; 7.10 Selection Methods; 7.11 Moving to a Specific Index; 7.12 Translating Indexes; 7.13 Counting Items; 7.14 Active Versus Selected; 7.15 Bounding Box; 7.16 Finding an Index by Y Coordinate; 7.17 Scrolling Methods; 7.18 Listbox Example; 7.19 Fun Things to Try; Chapter 8: The Text Widget; 8.1 Creating and Using a Text Widget; 8.2 Text Widget Options; 8.3 A Short Break for a Simple Example; 8.4 Text Indexes; 8.5 Text Tags; 8.6 Inserting Text; 8.7 Deleting Text; 8.8 Retrieving Text; 8.9 Translating Index Values; 8.10 Comparing Index Values; 8.11 Showing an Index; 8.12 Getting the Size of a Character; 8.13 Getting Line Information; 8.14 Searching the Contents of a Text Widget; 8.15 Scrolling; 8.16 Marks; 8.17 Embedding Widgets; 8.18 Internal Debug Flag; 8.19 Fun Things to Try; Chapter 9: The Canvas Widget; 9.1 Creating a Canvas; 9.2 Coordinate System; 9.3 The Scrollable Region; 9.4 Using Bind with a Canvas; 9.5 Canvas Options; 9.6 Creating Items in a Canvas; 9.7 Configuring the Canvas Widget; 9.8 Configuring Items in the Canvas Widget; 9.9 Tags; 9.10 Retrieving Bounding Box Coordinates; 9.11 Translating Coordinates; 9.12 Moving Items Around; 9.13 Changing the Display List; 9.14 Deleting Items; 9.15 Deleting Tags; 9.16 Determining Item Type; 9.17 Set Keyboard Focus; 9.18 Rendering the Canvas as PostScript; 9.19 Scaling the Canvas; 9.20 Scanning; 9.21 A Drawing Program Example; 9.22 Fun Things to Try; Chapter 10: The Scale Widget; 10.1 Creating a Scale; 10.2 Assigning a Callback; 10.3 Orientation; 10.4 Minimum and Maximum Values; 10.5 Displayed Versus Stored Value; 10.6 Adding a Label; 10.7 Displaying Value Increments; 10.8 Changing the Size of the Scale; 10.9 Options You'll Probably Never Need; 10.10 Configuring a Scale; 10.11 Getting the Value of a Scale; 10.12 Setting the Value of a Scale; 10.13 Determining Coordinates; 10.14 Identifying Parts of a Scale; 10.15 Fun Things to Try; Chapter 11: Menus; 11.1 Different Types of Menus; 11.2 The Menubutton Widget; 11.3 Complete Menubutton Examples; 11.4 The Menu Widget; 11.5 Optionmenu Widget; 11.6 Fun Things to Try; Chapter 12: Frames; 12.1 Creating a Frame; 12.2 Frame Style; 12.3 Frames Aren't Interactive; 12.4 Colormap Complications; 12.5 Frame Methods; 12.6 Fun Things to Try; Chapter 13: Toplevel Widgets; 13.1 Creating a Toplevel Widget; 13.2 Toplevel Methods; 13.3 Review; 13.4 Fun Things to Try; Chapter 14: Binding Events; 14.1 The bind Method; 14.2 Arguments Sent to the Callback; 14.3 Defining Event Sequences; 14.4 Event Information; 14.5 Bailing Out of a Callback Created with bind; 14.6 The bindtags Method; 14.7 Ways to Use bind; Chapter 15: Composite Widgets; 15.1 Looking at an Example Sideways; 15.2 Location of Files; 15.3 Creating a Composite Widget Based on Frame; 15.4 Toplevel-Based Composite Widgets; Chapter 16: Methods for Any Widget; 16.1 Building a Family Tree; 16.2 Color-Related Methods; 16.3 Option Databases; 16.4 The Application's Name; 16.5 Widget Existence; 16.6 Is the Widget Mapped?; 16.7 Converting Screen Distances; 16.8 Size of Widget; 16.9 Widget Position; 16.10 Screen Information; 16.11 Atom Methods; 16.12 Ringing a Bell; 16.13 Clipboard Methods; 16.14 Selection Methods; 16.15 Destroying a Widget; 16.16 Focus Methods; 16.17 Grab Methods; 16.18 Interapplication Communication; 16.19 Waiting for Events to Happen; 16.20 Parsing Command-Line Options; 16.21 Time Delays; Configuring Widgets with configure and cget; The configure Method; Default Values for Each Widget in Table Form; Operating System Differences; Unix; Windows NT and 95; Fonts; The Font String; Font Methods; Colophon;