Book description
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.
Table of contents
- Copyright
- Preface
-
Introduction to Perl/Tk
- A Bit of History About Perl (and Tk)
- Perl/Tk for Both Unix and Windows 95/NT
- Why Use a Graphical Interface?
- Why Use Perl/Tk?
- Installing the Tk Module
- Creating Widgets
- Coding Style
- Displaying a Widget
- The Anatomy of an Event Loop
- Hello World Example
- Using exit Versus Using destroy
- Naming Conventions for Widget Types
- Using print for Diagnostic/Debugging Purposes
- Designing Your Windows (A Short Lecture)
- Geometry Management
- The Basic Button
- Checkbuttons and Radiobuttons
- Label and Entry Widgets
- Scrollbars
-
The Listbox Widget
- Creating and Filling a Listbox
- Listbox Options
- Selection Modes
- Colors
- Listbox Style
- Configuring a Listbox
- Inserting Items
- Deleting Items
- Retrieving Elements
- Selection Methods
- Moving to a Specific Index
- Translating Indexes
- Counting Items
- Active Versus Selected
- Bounding Box
- Finding an Index by Y Coordinate
- Scrolling Methods
- Listbox Example
- Fun Things to Try
-
The Text Widget
- Creating and Using a Text Widget
- Text Widget Options
- A Short Break for a Simple Example
- Text Indexes
- Text Tags
- Inserting Text
- Deleting Text
- Retrieving Text
- Translating Index Values
- Comparing Index Values
- Showing an Index
- Getting the Size of a Character
- Getting Line Information
- Searching the Contents of a Text Widget
- Scrolling
- Marks
- Embedding Widgets
- Internal Debug Flag
- Fun Things to Try
-
The Canvas Widget
- Creating a Canvas
- Coordinate System
- The Scrollable Region
- Using Bind with a Canvas
- Canvas Options
- Creating Items in a Canvas
- Configuring the Canvas Widget
- Configuring Items in the Canvas Widget
- Tags
- Retrieving Bounding Box Coordinates
- Translating Coordinates
- Moving Items Around
- Changing the Display List
- Deleting Items
- Deleting Tags
- Determining Item Type
- Set Keyboard Focus
- Rendering the Canvas as PostScript
- Scaling the Canvas
- Scanning
- A Drawing Program Example
- Fun Things to Try
-
The Scale Widget
- Creating a Scale
- Assigning a Callback
- Orientation
- Minimum and Maximum Values
- Displayed Versus Stored Value
- Adding a Label
- Displaying Value Increments
- Changing the Size of the Scale
- Options You'll Probably Never Need
- Configuring a Scale
- Getting the Value of a Scale
- Setting the Value of a Scale
- Determining Coordinates
- Identifying Parts of a Scale
- Fun Things to Try
- Menus
- Frames
- Toplevel Widgets
- Binding Events
- Composite Widgets
-
Methods for Any Widget
- Building a Family Tree
- Color-Related Methods
- Option Databases
- The Application's Name
- Widget Existence
- Is the Widget Mapped?
- Converting Screen Distances
- Size of Widget
- Widget Position
- Screen Information
- Atom Methods
- Ringing a Bell
- Clipboard Methods
- Selection Methods
- Destroying a Widget
- Focus Methods
- Grab Methods
- Interapplication Communication
- Waiting for Events to Happen
- Parsing Command-Line Options
- Time Delays
- Configuring Widgets with configure and cget
- Operating System Differences
- Fonts
- Colophon
- Index
Product information
- Title: Learning Perl/Tk
- Author(s):
- Release date: January 1999
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781565923140
You might also like
article
Reinventing the Organization for GenAI and LLMs
Previous technology breakthroughs did not upend organizational structure, but generative AI and LLMs will. We now …
book
Web, Graphics & Perl/Tk Programming
In its first five years of existence, The Perl Journal (TPJ) became the voice of the …
book
Mastering Perl/Tk
Perl/Tk is the marriage of the Tk graphical toolkit with Perl, the powerful programming language used …
book
Games, Diversions & Perl Culture
The Perl Journal ( TPJ) did something most print journals aspire to, but few succeed. Within …