Cover image for Mastering Perl/Tk

Book description

Perl/Tk is the marriage of the Tk graphical toolkit with Perl, the powerful programming language used primarily for system administration, web programming, and database manipulation. With Perl/Tk, you can build Perl programs with an attractive, intuitive GUI interface with all the power of Perl behind it. Mastering Perl/Tk is the "bible" of Perl/Tk: It's not only a great book for getting started, but the best reference for learning the techniques of experienced Perl/Tk programmers. The first half of the book contains the basics on how to use Perl/Tk, and then branches out into advanced applications with a series of extensive program examples. The result is a book accessible for novices, and invaluable for experienced programmers ready to learn the next step in the elegant and effective use of Perl/Tk. The book includes:

  • An introduction to each of the basic Perl/Tk widgets and geometry managers

  • A dissection of the MainLoop, including how to use callbacks and bindings effectively

  • Coverage of the Tix widgets, an extended set of widgets that are a part of the standard Perl/Tk distribution

  • Working with images in Perl/Tk, including bitmaps, pixmaps, photos, and how to compose a compound image type

  • How to create custom mega-widgets in Perl/Tk, both composite and derived

  • Handling interprocess communication with Perl/Tk, both with standard Unix utilities (pipes and sockets) and with the send command designed for direct communication between Tk applications

  • Developing your own Tk widget in the C language

  • Examples of web applications written with Perl/Tk and the LWP library

The book also includes appendices on installing Perl/Tk, a complete quick-reference for each standard widget, and listings of all the extended examples in the book. Nancy Walsh is the author of Learning Perl/Tk, and Steve Lidie wrote the Perl/Tk Pocket Reference as well as a series of Perl/Tk articles in The Perl Journal. Together, they have written Mastering Perl/Tk to be the definitive guide to Perl/Tk.

Table of Contents

  1. Mastering Perl/Tk
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. A Note Regarding Supplemental Files
    3. Preface
      1. History of This Book
      2. What You Should Already Know
      3. What's in This Book
      4. Reading Order
      5. Typographical Conventions
      6. We'd Like to Hear from You
      7. Acknowledgments
        1. Steve
        2. Nancy
    4. 1. Hello, Perl/Tk
      1. 1.1. Perl/Tk Concepts
      2. 1.2. Some Perl/Tk History
        1. 1.2.1. The X Window System and Xlib
        2. 1.2.2. The Coming of Tcl/Tk
        3. 1.2.3. The Evolution of Perl/Tk
        4. 1.2.4. Perl/Tk Meets Win32
      3. 1.3. Getting Started with Perl/Tk
        1. 1.3.1. Do You Need To Install Anything?
        2. 1.3.2. Creating Widgets
        3. 1.3.3. Specifying Options
        4. 1.3.4. Toplevel, MainWindow, and Frame Widgets
        5. 1.3.5. Displaying a Widget
        6. 1.3.6. The Event Loop
      4. 1.4. Hello World Example
        1. 1.4.1. exit Versus destroy
      5. 1.5. Unsolicited Advice
        1. 1.5.1. Programming Style
        2. 1.5.2. Naming Conventions for Widget Types
        3. 1.5.3. Designing Your Windows
      6. 1.6. Debugging and PrototypingPerl/Tk Programs
    5. 2. Geometry Management
      1. 2.1. The pack Geometry Manager
        1. 2.1.1. Options for pack
        2. 2.1.2. Positioning Widgets
        3. 2.1.3. Allocation Rectangles
        4. 2.1.4. Filling the Allocation Rectangle
        5. 2.1.5. Expanding the Allocation Rectangle
        6. 2.1.6. Anchoring a Widget in Its Allocation Rectangle
        7. 2.1.7. Widget Order in the Window
        8. 2.1.8. Padding the Size of the Widget
          1. 2.1.8.1. Valid screen distances
        9. 2.1.9. Displaying in a Parent Other Than Your Own
        10. 2.1.10. Methods Associated with pack
          1. 2.1.10.1. Unpacking a widget
          2. 2.1.10.2. Retrieving pack information
          3. 2.1.10.3. Disabling and enabling automatic resizing
          4. 2.1.10.4. Listing widgets
        11. 2.1.11. Demo Programs for pack
      2. 2.2. The grid Geometry Manager
        1. 2.2.1. Special Characters
          1. 2.2.1.1. Spanning columns
          2. 2.2.1.2. Empty cells
        2. 2.2.2. grid Options
        3. 2.2.3. Specifying Rows and Columns Explicitly
        4. 2.2.4. Spanning Rows and Columns Explicitly
        5. 2.2.5. Forcing a Widget to Fill a Cell
        6. 2.2.6. Padding the Widget
        7. 2.2.7. Specifying a Different Parent
        8. 2.2.8. Configuring Columns and Rows
          1. 2.2.8.1. Weight
          2. 2.2.8.2. Minimum cell size
          3. 2.2.8.3. Padding
          4. 2.2.8.4. Bounding box
        9. 2.2.9. Removing a Widget
        10. 2.2.10. Getting Information
        11. 2.2.11. Widget Location
          1. 2.2.11.1. Propagation
        12. 2.2.12. How Many Columns and Rows?
        13. 2.2.13. gridSlaves
      3. 2.3. The place Geometry Manager
        1. 2.3.1. place Options
        2. 2.3.2. Absolute Coordinates
        3. 2.3.3. Relative Coordinates
        4. 2.3.4. Anchoring the Widget
        5. 2.3.5. Width and Height
        6. 2.3.6. Border Options
        7. 2.3.7. Methods Associated with place
          1. 2.3.7.1. Removing the widget
          2. 2.3.7.2. Place information
          3. 2.3.7.3. Place slaves
      4. 2.4. The form Geometry Manager
        1. 2.4.1. Options for form
        2. 2.4.2. Attachments
          1. 2.4.2.1. Attaching to the grid
          2. 2.4.2.2. Widget-to-widget attachments
          3. 2.4.2.3. Attaching to nothing
        3. 2.4.3. Springs
        4. 2.4.4. form Methods
          1. 2.4.4.1. Changing the grid size
          2. 2.4.4.2. Removing a widget from a container
          3. 2.4.4.3. Options info for form
          4. 2.4.4.4. What's managed by form?
          5. 2.4.4.5. Circular dependency check
      5. 2.5. Geometry Management Summary
    6. 3. Fonts
      1. 3.1. Experimenting with Fonts
      2. 3.2. Dissecting a Font
      3. 3.3. Using Fonts
        1. 3.3.1. System Fonts
      4. 3.4. Using Fonts Dynamically
      5. 3.5. Font Manipulation Methods
        1. 3.5.1. One Last Example
    7. 4. Button, Checkbutton, and Radiobutton Widgets
      1. 4.1. Creating Button Widgets
      2. 4.2. Standard Options for Each Button Type
      3. 4.3. Table of Options for Button-Type Widgets
      4. 4.4. Displaying Text on Buttons
      5. 4.5. Displaying an Image or Bitmap
        1. 4.5.1. Images with Checkbuttons and Radiobuttons
      6. 4.6. Checkbutton and Radiobutton Indicator Status
      7. 4.7. On and Off Values for a Checkbutton
      8. 4.8. Radiobutton Values
      9. 4.9. The -command Option
      10. 4.10. Disabling a Button
      11. 4.11. Text Manipulation
      12. 4.12. Altering the Button's Style
      13. 4.13. Changing the Size of a Button
      14. 4.14. Adding a Keyboard Mapping
      15. 4.15. Color Options
      16. 4.16. Indicator Colors
      17. 4.17. Hiding the Indicator
      18. 4.18. Focus Options
      19. 4.19. Altering the Highlight Rectangle
      20. 4.20. Configuring a Button
      21. 4.21. Flashing the Button
      22. 4.22. Invoking the Button
      23. 4.23. Turning a Checkbutton/Radiobutton On and Off
    8. 5. Label and Entry Widgets
      1. 5.1. The Label Widget
        1. 5.1.1. Creating a Label
        2. 5.1.2. Label Options
        3. 5.1.3. How a Label Differs from Other Widgets
        4. 5.1.4. Relief
        5. 5.1.5. Status Message Example
        6. 5.1.6. Container Frames
        7. 5.1.7. Label Configuration
      2. 5.2. The Entry Widget
        1. 5.2.1. Creating the Entry Widget
        2. 5.2.2. Entry Options
        3. 5.2.3. Assigning the Entry's Contents to a Variable
        4. 5.2.4. Relief
        5. 5.2.5. Entry Indexes
        6. 5.2.6. Text Selection Options
        7. 5.2.7. The Insert Cursor
        8. 5.2.8. Password Entries
        9. 5.2.9. Entry Widget Validation
        10. 5.2.10. Using a Scrollbar
        11. 5.2.11. Configuring an Entry Widget
        12. 5.2.12. Deleting Text
        13. 5.2.13. Getting the Contents of an Entry Widget
        14. 5.2.14. Moving the Insertion Cursor
        15. 5.2.15. Getting a Numeric Index Value
        16. 5.2.16. Inserting Text
        17. 5.2.17. Scanning Text
        18. 5.2.18. Working with the Selection
        19. 5.2.19. Changing the View in the Entry Widget
      3. 5.3. The Perl/Tk LabEntry Mega-Widget
    9. 6. The Scrollbar Widget
      1. 6.1. Defining Scrollbar Parts
      2. 6.2. The Scrolled Method
        1. 6.2.1. Configuring the Scrollbar(s) Created with Scrolled
      3. 6.3. The Scrollbar Widget
        1. 6.3.1. Creating a Scrollbar Widget
        2. 6.3.2. Scrollbar Options
        3. 6.3.3. Scrollbar Colors
        4. 6.3.4. Scrollbar Style
        5. 6.3.5. Scrollbar Orientation
        6. 6.3.6. Using the Arrows and the Slider
        7. 6.3.7. Assigning a Callback
        8. 6.3.8. How the Scrollbar Communicates with Other Widgets
        9. 6.3.9. Scrollbar Configuration
        10. 6.3.10. Defining What We Can See
        11. 6.3.11. Getting the Current View
        12. 6.3.12. Activating Elements in a Scrollbar
        13. 6.3.13. Calculating Change from Pixels
        14. 6.3.14. Locating a Point in the Trough
        15. 6.3.15. Identifying Elements
      4. 6.4. Examples
        1. 6.4.1. Entry Widget
        2. 6.4.2. Listbox, Text, and Canvas Widgets
        3. 6.4.3. One Scrollbar, Multiple Widgets
    10. 7. The Listbox Widget
      1. 7.1. Creating and Filling a Listbox
      2. 7.2. Listbox Options
      3. 7.3. Selection Modes
        1. 7.3.1. Operating System Differences
      4. 7.4. Colors
      5. 7.5. Listbox Style
        1. 7.5.1. Style of Selected Items
        2. 7.5.2. Special Listbox Resizing
      6. 7.6. Configuring a Listbox
      7. 7.7. Inserting Items
      8. 7.8. Deleting Items
      9. 7.9. Retrieving Elements
      10. 7.10. Selection Methods
        1. 7.10.1. Selecting Items
        2. 7.10.2. Unselecting Items
        3. 7.10.3. Testing for Selection
        4. 7.10.4. Anchoring the Selection
      11. 7.11. Moving to a Specific Index
      12. 7.12. Translating Indexes
      13. 7.13. Counting Items
      14. 7.14. Active Versus Selected
      15. 7.15. Bounding Box
      16. 7.16. Finding an Index by y Coordinate
      17. 7.17. Scrolling Methods
      18. 7.18. Listbox Virtual Events
      19. 7.19. Listbox Example
    11. 8. The Text, TextUndo,and ROText Widgets
      1. 8.1. Creating and Using a Text Widget
      2. 8.2. Text Widget Options
        1. 8.2.1. Fonts
        2. 8.2.2. Widget Size
        3. 8.2.3. Widget Style
        4. 8.2.4. Line Spacing
        5. 8.2.5. Tab Stops
      3. 8.3. A Short Break for a Simple Example
      4. 8.4. Text Indexes
        1. 8.4.1. Base Index Values
        2. 8.4.2. Index Modifiers
        3. 8.4.3. Text Index Examples
      5. 8.5. Text Tags
        1. 8.5.1. Tag Options
        2. 8.5.2. A Simple Tag Example
        3. 8.5.3. Selections in a Text Widget Using the "sel" Tag
        4. 8.5.4. Configuring and Creating Tags
        5. 8.5.5. Adding a Tag to Existing Text
        6. 8.5.6. Using bind with Tags
          1. 8.5.6.1. The Perl/Tk Text widget extended bindings
        7. 8.5.7. Deleting All Instances of a Tag
        8. 8.5.8. Removing a Tag from the Text
        9. 8.5.9. Raising and Lowering Tags
        10. 8.5.10. Getting Tag Names
        11. 8.5.11. Determining Where a Tag Applies
      6. 8.6. Inserting Text
        1. 8.6.1. Inserting Lines Using print and printf
      7. 8.7. Deleting Text
      8. 8.8. Retrieving Text
      9. 8.9. Translating Index Values
      10. 8.10. Comparing Index Values
      11. 8.11. Showing an Index
      12. 8.12. Getting the Size of a Character
      13. 8.13. Getting Line Information
      14. 8.14. Searching the Contents of a Text Widget
      15. 8.15. Scrolling
      16. 8.16. Marks
        1. 8.16.1. Setting and Getting the Gravity
        2. 8.16.2. Determining Mark Names
        3. 8.16.3. Creating and Deleting Marks
      17. 8.17. Embedding Widgets
        1. 8.17.1. windowCreate, windowCget, and windowConfigure
      18. 8.18. Internal Debug Flag
        1. 8.18.1. Scanning
      19. 8.19. The Perl/Tk Text Widget Extended Methods
      20. 8.20. The TextUndo Widget
        1. 8.20.1. TextUndo Virtual Events
      21. 8.21. The ROText Widget
    12. 9. The Canvas Widget
      1. 9.1. Creating a Canvas
      2. 9.2. The Canvas Coordinate System
      3. 9.3. The Scrollable Region
      4. 9.4. Using bind with a Canvas
      5. 9.5. Canvas Options
        1. 9.5.1. Common Canvas Dash, Stipple, and Tile Options
        2. 9.5.2. Additional Scrolling Options
        3. 9.5.3. Canvas Widget Option List
      6. 9.6. Creating Items in a Canvas
        1. 9.6.1. The Arc Item
        2. 9.6.2. The Bitmap Item
        3. 9.6.3. The Image Item
        4. 9.6.4. The Line Item
        5. 9.6.5. The Oval Item
        6. 9.6.6. The Polygon Item
        7. 9.6.7. The Rectangle Item
        8. 9.6.8. The Text Item
          1. 9.6.8.1. Text item indexes
          2. 9.6.8.2. Deleting characters
          3. 9.6.8.3. Positioning the cursor
          4. 9.6.8.4. Index information
          5. 9.6.8.5. Adding text
          6. 9.6.8.6. Selecting text
        9. 9.6.9. The Widget Item
        10. 9.6.10. The Grid Item
        11. 9.6.11. The Group Item
      7. 9.7. Configuring the Canvas Widget
      8. 9.8. Configuring Items in the Canvas Widget
      9. 9.9. Tags
        1. 9.9.1. Binding Items Using Tags
        2. 9.9.2. Finding Tags
        3. 9.9.3. Getting Tags from a Specific Item
      10. 9.10. Retrieving Bounding Box Coordinates
      11. 9.11. Translating Coordinates
      12. 9.12. Moving Items Around
      13. 9.13. Changing the Display List
      14. 9.14. Deleting Items
      15. 9.15. Deleting Tags
      16. 9.16. Determining Item Type
      17. 9.17. Setting Keyboard Focus
      18. 9.18. Rendering the Canvas as PostScript
      19. 9.19. Scaling the Canvas
      20. 9.20. Scanning
        1. 9.20.1. Scrolling Methods
      21. 9.21. A Drawing Program Example
    13. 10. The Scale Widget
      1. 10.1. Creating a Scale
      2. 10.2. Assigning a Callback
      3. 10.3. Orientation
      4. 10.4. Minimum and Maximum Values
      5. 10.5. Displayed Versus Stored Value
      6. 10.6. Adding a Label
      7. 10.7. Displaying Value Increments
      8. 10.8. Changing the Size of the Scale
      9. 10.9. Options You'll Probably Never Need
      10. 10.10. Configuring a Scale
      11. 10.11. Getting the Value of a Scale
      12. 10.12. Setting the Value of a Scale
      13. 10.13. Determining Coordinates
      14. 10.14. Identifying Parts of a Scale
    14. 11. Frame, MainWindow,and Toplevel Widgets
      1. 11.1. Creating a Frame
      2. 11.2. Creating a Toplevel Widget
      3. 11.3. Options
        1. 11.3.1. Frame-Specific Options
        2. 11.3.2. Toplevel-Specific Options
        3. 11.3.3. Viewing a Frame
        4. 11.3.4. Adding a Label to a Frame
        5. 11.3.5. Frames Aren't Interactive
        6. 11.3.6. Colormap Complications
        7. 11.3.7. The Magical Class Option
      4. 11.4. Frame Methods
      5. 11.5. Toplevel Methods
        1. 11.5.1. Sizing a Toplevel
        2. 11.5.2. Maximum Size
        3. 11.5.3. Minimum Size
        4. 11.5.4. Limiting Resizing
        5. 11.5.5. Using a Size Aspect
        6. 11.5.6. Setting the Title
        7. 11.5.7. Showing the Toplevel
        8. 11.5.8. Withdrawing the Toplevel
        9. 11.5.9. Iconifying the Toplevel
        10. 11.5.10. Specifying the Icon Bitmap
        11. 11.5.11. Specifying the Icon Mask
        12. 11.5.12. Setting the Name of the Icon
        13. 11.5.13. Setting the Icon Position
        14. 11.5.14. Using a Window Instead of an Icon
        15. 11.5.15. Determining the State
        16. 11.5.16. Assigning a Client Name
        17. 11.5.17. Window Properties
        18. 11.5.18. The Colormap Property
        19. 11.5.19. The Command Property
        20. 11.5.20. The Focus Model
        21. 11.5.21. Getting a Widget's Window ID
        22. 11.5.22. The Application Grid
        23. 11.5.23. Being the Leader
        24. 11.5.24. Removing Decorations
        25. 11.5.25. Who Placed the Window?
        26. 11.5.26. Who Sized It?
        27. 11.5.27. Transient Windows
      6. 11.6. Creating Multiple MainWindows
      7. 11.7. Putting Two MainWindows to Work
    15. 12. The Menu System
      1. 12.1. Menu System Components
        1. 12.1.1. Menus and Menu Items
        2. 12.1.2. Menu Indexes
        3. 12.1.3. Manipulating Menus
        4. 12.1.4. Manipulating Menu Items
        5. 12.1.5. Menubars
        6. 12.1.6. Menu Options
      2. 12.2. Menubars and Pulldown Menus
        1. 12.2.1. Menubars the Clunky, Casual, Old-Fashioned Way
        2. 12.2.2. Menubars the Slick, Sophisticated, New-Fashioned Way
      3. 12.3. The Win32 System Menu Item
      4. 12.4. Classical Menubars
        1. 12.4.1. Menubutton Options
        2. 12.4.2. Button-Only Options
      5. 12.5. Popup Menus
        1. 12.5.1. The post and Post Methods
        2. 12.5.2. The Popup Method
          1. 12.5.2.1. Popup examples
      6. 12.6. Option Menus
        1. 12.6.1. Tk::Optionmenu
        2. 12.6.2. A Native Option Menu
      7. 12.7. Menu Virtual Events
      8. 12.8. Pie Menus
        1. 12.8.1. Fitts' Law
    16. 13. Miscellaneous Perl/Tk Methods
      1. 13.1. Managing Widgets with configure and cget
        1. 13.1.1. The configure Method
        2. 13.1.2. The cget Method
      2. 13.2. Building a Family Tree
        1. 13.2.1. Widget's Children
        2. 13.2.2. Name of a Widget
        3. 13.2.3. Parent of a Widget
        4. 13.2.4. The Widget's Toplevel
        5. 13.2.5. Widget's Manager
        6. 13.2.6. The Widget's class
      3. 13.3. Widget's ID
        1. 13.3.1. Widget's PathName From Its X11 ID
      4. 13.4. Color-Related Methods
        1. 13.4.1. Is the Colormap Full?
        2. 13.4.2. Cell Count
        3. 13.4.3. Color Depth
        4. 13.4.4. Translate to RGB Value
        5. 13.4.5. Setting Colors
        6. 13.4.6. Predefined Color Scheme
      5. 13.5. The Application's Name
      6. 13.6. Widget Existence
      7. 13.7. Is the Widget Mapped?
      8. 13.8. Converting Screen Distances
      9. 13.9. Size of Widget
        1. 13.9.1. Widget's Geometry
        2. 13.9.2. Requested Height
        3. 13.9.3. Requested Width
        4. 13.9.4. Actual Width
        5. 13.9.5. Actual Height
      10. 13.10. Widget Position
        1. 13.10.1. Position Relative to the Root Window
        2. 13.10.2. Coordinates Relative to the Parent
        3. 13.10.3. Coordinates Relative to the Root Window
        4. 13.10.4. Virtual Desktop Coordinates
        5. 13.10.5. Cursor Coordinates Relative to the Desktop
      11. 13.11. Screen Information
        1. 13.11.1. Screen Name
        2. 13.11.2. Screen Height and Width
        3. 13.11.3. Cell Count
        4. 13.11.4. Screen Depth
        5. 13.11.5. Color Type
        6. 13.11.6. Server Type
        7. 13.11.7. Is the Widget Viewable?
      12. 13.12. Atom Methods
      13. 13.13. Ringing a Bell
      14. 13.14. Clipboard and Selection Methods
        1. 13.14.1. Clipboard Methods
        2. 13.14.2. Selection Methods
          1. 13.14.2.1. Clearing the selection
          2. 13.14.2.2. Getting the selection
          3. 13.14.2.3. Assigning a callback
          4. 13.14.2.4. Determining the owner
          5. 13.14.2.5. Setting the owner
        3. 13.14.3. Exporting the Selection to the Outside World
      15. 13.15. Destroying a Widget
      16. 13.16. Focus Methods
        1. 13.16.1. Keyboard Traversal
          1. 13.16.1.1. Tabbing between widgets
          2. 13.16.1.2. Default widget bindings
          3. 13.16.1.3. Menu Traversal
      17. 13.17. Grab Methods
      18. 13.18. Marking a Widget Busy and Unbusy
      19. 13.19. Widget Mapping and Layering
      20. 13.20. Interapplication Communication
      21. 13.21. Waiting for Events to Happen
        1. 13.21.1. File Events
      22. 13.22. Time Delays
      23. 13.23. Parsing Command-Line Options
      24. 13.24. Really Miscellaneous Methods
    17. 14. Creating Custom Widgets in Pure Perl/Tk
      1. 14.1. A Mega-Widget Quick-Start
      2. 14.2. The Perl/Tk Class Hierarchy
      3. 14.3. Mega-Widget Implementation Details
        1. 14.3.1. Tk::Widget::new, the Real Perl/Tk Widget Constructor
        2. 14.3.2. Subroutine ClassInit
        3. 14.3.3. Subroutine CreateArgs
        4. 14.3.4. Subroutine SetBindtags
        5. 14.3.5. Subroutine Populate
        6. 14.3.6. Subroutine ConfigSpecs
          1. 14.3.6.1. ConfigSpecs Examples
        7. 14.3.7. Subroutine Delegates
        8. 14.3.8. Other Useful Methods
          1. 14.3.8.1. Subroutine Advertise
          2. 14.3.8.2. Subroutine Callback
          3. 14.3.8.3. Subroutine Component
          4. 14.3.8.4. Subroutine Descendants
          5. 14.3.8.5. Subroutine Subwidget
          6. 14.3.8.6. Subroutine Walk
        9. 14.3.9. Mega-Widget Instance Variables
      4. 14.4. Composite Mega-Widgets
        1. 14.4.1. Tk::Thermometer
      5. 14.5. Derived Mega-Widgets
        1. 14.5.1. Tk::NavListbox
        2. 14.5.2. Tk::CanvasPlot
        3. 14.5.3. Tk::LCD
      6. 14.6. Packaging a Mega-Widget for Public Distribution
        1. 14.6.1. Packaging for CPAN
        2. 14.6.2. Packaging for PPM
    18. 15. Anatomy of the MainLoop
      1. 15.1. Creating a Callback
        1. 15.1.1. Callbacks and Closures
      2. 15.2. Binding to Events
        1. 15.2.1. Event Descriptor Syntax
          1. 15.2.1.1. Event descriptor modifiers
          2. 15.2.1.2. Event descriptor types
        2. 15.2.2. The Event Structure
          1. 15.2.2.1. The exporter tag :variables
          2. 15.2.2.2. Event information methods
        3. 15.2.3. Widget Class Bindings
        4. 15.2.4. Widget Instance Bindings
        5. 15.2.5. Binding to a MouseWheel Event
        6. 15.2.6. Canvas Bindings
      3. 15.3. The bindtags Command
        1. 15.3.1. How Might We Use bindtags?
        2. 15.3.2. bindDump—Dump Lots of Binding Information
      4. 15.4. Executing Nonblocking System Commands
        1. 15.4.1. fileevent Syntax
        2. 15.4.2. Tk::ExecuteCommand
        3. 15.4.3. An MPG Player—tkmpg123
      5. 15.5. Tracing Perl/Tk Variables
        1. 15.5.1. Tie::Watch
      6. 15.6. Nonblocking Wait Activities
        1. 15.6.1. Tk::waitVariableX
      7. 15.7. Splash Screens
        1. 15.7.1. Tk::Splashscreen
      8. 15.8. Synthesizing Virtual Events
      9. 15.9. Coexisting with Other GUI Main Loops
        1. 15.9.1. Embedding OpenGL in a Perl/Tk Window
        2. 15.9.2. Flying the Enterprise
    19. 16. User Customization
      1. 16.1. Using the Command Line
        1. 16.1.1. Colors, Fonts, and Titles
        2. 16.1.2. Initial MainWindow Placement
        3. 16.1.3. Choosing a Display
        4. 16.1.4. Option Database Lookups
        5. 16.1.5. Synchronizing Window Messages
      2. 16.2. Using the Option Database
        1. 16.2.1. Manipulating Resources with option* Methods
        2. 16.2.2. Manipulating Resources with Tk::CmdLine Subroutines
    20. 17. Images and Animations
      1. 17.1. An Overview of Perl/Tk Image Types
      2. 17.2. Methods Common to All Image Types
      3. 17.3. Bitmap Primitives
      4. 17.4. DefineBitmap
      5. 17.5. The Bitmap Image Type
        1. 17.5.1. Cool Tricks with an Empty Bitmap
          1. 17.5.1.1. An invisible cursor
          2. 17.5.1.2. Filling a transparent Canvas item
      6. 17.6. The Pixmap Image Type
      7. 17.7. The Photo Image Type
        1. 17.7.1. Creating a Color Palette with the put Method
        2. 17.7.2. Using put to Create a Progress Bar with a 3D Look
        3. 17.7.3. Capturing a Window with Tk::WinPhoto
          1. 17.7.3.1. What you see is not always what you get
        4. 17.7.4. Tk::Thumbnail
      8. 17.8. The Compound Image Type
      9. 17.9. Tk::Animation
      10. 17.10. tkneko—Animating the Neko on a Canvas
      11. 17.11. Tile and Transparent Images
      12. 17.12. Miscellaneous Image Methods
      13. 17.13. Simple Photo Rotations
    21. 18. A Tk Interface Extension Tour
      1. 18.1. Display Items
      2. 18.2. Item Styles
        1. 18.2.1. Item Style Methods
      3. 18.3. The TList Widget
        1. 18.3.1. TList Indexes and Methods
      4. 18.4. The HList Family of Widgets
        1. 18.4.1. Using Indicators with HList
        2. 18.4.2. HList Methods
        3. 18.4.3. The Tree Widget
        4. 18.4.4. Tree Methods
        5. 18.4.5. The DirTree Widget
        6. 18.4.6. Adding a Directory
      5. 18.5. Tix Images
    22. 19. Interprocess Communicationwith Pipes and Sockets
      1. 19.1. Handling Unsolicited Media Changes
        1. 19.1.1. The Media Change Client, mediachangec
        2. 19.1.2. The Media Change Server, mediachanged
      2. 19.2. IPADM Design Considerations
      3. 19.3. The Perl/Tk IPADM Client, ipadm
        1. 19.3.1. Creating the Hypertext User Interface
        2. 19.3.2. The Subnet Widget Edits a Subnet Description
        3. 19.3.3. Starting the IPADM Helper Task
        4. 19.3.4. fileevent Keeps ipadm Happy
      4. 19.4. The IPADM Helper, ipadmh
      5. 19.5. The IPADM Daemon, ipadmd
        1. 19.5.1. The Forking Server
        2. 19.5.2. IPADM Message Handling
        3. 19.5.3. Locking an SDB File
        4. 19.5.4. Updating the DHCP and DNS Configuration Files
        5. 19.5.5. What About Security?
      6. 19.6. Polling Win32 Sockets
    23. 20. IPC with send
      1. 20.1. Security and Inter-Language Considerations
        1. 20.1.1. Application Names
        2. 20.1.2. Tk::Receive
      2. 20.2. Computing π with Parallel Message Passing
        1. 20.2.1. The Message Passing Protocol
        2. 20.2.2. Tcl/Tk Slave Processor Code
        3. 20.2.3. Tcl/Tk Master Processor Code
      3. 20.3. TclRobots
        1. 20.3.1. TclRobots.pm, the Perl Interface to TclRobots
          1. 20.3.1.1. Tk::Receive handles tclrobots to Perl communications
          2. 20.3.1.2. The RCP API handles Perl to tclrobots communications
        2. 20.3.2. Robot Control Programs
    24. 21. C Widget Internals
      1. 21.1. The Tk::Square Widget
        1. 21.1.1. Tcl/Tk Example
        2. 21.1.2. Overview of the Perl/Tk Distribution
        3. 21.1.3. Layout of a Typical C Widget
          1. 21.1.3.1. Tk::Square instance structure
          2. 21.1.3.2. Tk::Square configuration specifications
          3. 21.1.3.3. Tk::Square instance constructor
          4. 21.1.3.4. Tk::Square method processors
          5. 21.1.3.5. Tk::Square option configurator
          6. 21.1.3.6. Tk::Square event handler
          7. 21.1.3.7. Tk::Square drawing handler
          8. 21.1.3.8. Tk::Square destructor
      2. 21.2. Interfacing tkSquare.c with Perl/Tk
        1. 21.2.1. Makefile.PL
        2. 21.2.2. Square.xs
        3. 21.2.3. Square.pm
        4. 21.2.4. pTk/Makefile.PL
      3. 21.3. Building and Testing Tk::Square
        1. 21.3.1. t/square_demo.t
      4. 21.4. How Not to Port Tk::Square
    25. 22. Perl/Tk and the Web
      1. 22.1. Library for WWW Access in Perl
        1. 22.1.1. LWP::Simple, the Easiest Way to the Web
        2. 22.1.2. Fetching Web Content with LWP::UserAgent
        3. 22.1.3. lwp-request and fileevent Rule
        4. 22.1.4. The Recipe for Displaying Web Images
        5. 22.1.5. Win32 Considerations
          1. 22.1.5.1. fork and local Win32 sockets
          2. 22.1.5.2. fork and LWP::UserAgent
          3. 22.1.5.3. Win32::Process and shared memory
        6. 22.1.6. Tidying an Ugly Mess
      2. 22.2. The PerlPlus Browser Plug-in
        1. 22.2.1. Embedding Perl/Tk in Other Windows
        2. 22.2.2. Embedded Versus Full-Screen Mode
        3. 22.2.3. How You Can Contribute to the PerlPlus Plug-in Project
    26. 23. Plethora of pTk Potpourri
      1. 23.1. pTk Special Variables and Exporter Symbols
        1. 23.1.1. Global Variables
        2. 23.1.2. Symbols Exported by Default
        3. 23.1.3. Optionally Exported Symbols
        4. 23.1.4. Exporter Tags
      2. 23.2. Manipulating the Cursor
        1. 23.2.1. Creating Your Own Custom Cursor Shape
      3. 23.3. Dialog Boxes
        1. 23.3.1. The Dialog Widget
        2. 23.3.2. The messageBox Method
        3. 23.3.3. The DialogBox Widget
        4. 23.3.4. Using ErrorDialog
        5. 23.3.5. chooseColor Dialog
        6. 23.3.6. getOpenFile and getSaveFile Dialogs
      4. 23.4. The Adjuster Widget
      5. 23.5. The Balloon Widget
      6. 23.6. The BrowseEntry Widget
      7. 23.7. The LabFrame Widget
        1. 23.7.1. LabFrame Options
      8. 23.8. The NoteBook Widget
        1. 23.8.1. Creating Pages
        2. 23.8.2. WordCount Example Using a NoteBook
        3. 23.8.3. NoteBook Limitations
      9. 23.9. The Pane Widget
        1. 23.9.1. Pane Options
      10. 23.10. The ProgressBar Widget
        1. 23.10.1. ProgressBar Options
      11. 23.11. Widgets Not in the Perl/Tk Distribution
    27. A. Installing Perl/Tk
      1. A.1. Installing Perl/Tk for Unix
      2. A.2. Installing Perl/Tk for Win32
    28. B. Options and Default Valuesfor Each Widget
      1. B.1. Adjuster
      2. B.2. Balloon
      3. B.3. Bitmap
      4. B.4. BrowseEntry
      5. B.5. Button
      6. B.6. Canvas
      7. B.7. Checkbutton
      8. B.8. ColorEditor
      9. B.9. Dialog
      10. B.10. DirTree
      11. B.11. Entry
      12. B.12. ErrorDialog
      13. B.13. FileSelect
      14. B.14. Frame
      15. B.15. HList
      16. B.16. Label
      17. B.17. LabEntry
      18. B.18. LabFrame
      19. B.19. Listbox
      20. B.20. MainWindow
      21. B.21. Menu
      22. B.22. Menubutton
      23. B.23. Message
      24. B.24. NoteBook
      25. B.25. Optionmenu
      26. B.26. Pane
      27. B.27. Photo
      28. B.28. ProgressBar
      29. B.29. Radiobutton
      30. B.30. ROText
      31. B.31. Scale
      32. B.32. Scrollbar
      33. B.33. Table
      34. B.34. Text
      35. B.35. TextUndo
      36. B.36. Tiler
      37. B.37. TList
      38. B.38. Toplevel
      39. B.39. Tree
    29. C. Complete Program Listings
      1. C.1. Tk::CollapsableFrame
      2. C.2. Tk::MacCopy
      3. C.3. Tk::ExecuteCommand
      4. C.4. Proc::Killfam
      5. C.5. tkmpg123
      6. C.6. Tk::Trace
      7. C.7. tkhp16c
      8. C.8. Tk::MacProgressBar
      9. C.9. TclRobots.pm
      10. C.10. Robot Control Program complex.ptr
      11. C.11. clock-bezier.ppl
      12. C.12. tkhanoi.ppl
    30. Index
    31. About the Authors
    32. Colophon
    33. SPECIAL OFFER: Upgrade this ebook with O’Reilly