Skip to Main Content
Learning Perl/Tk
book

Learning Perl/Tk

by Nancy Walsh
January 1999
Beginner content levelBeginner
373 pages
9h 43m
English
O'Reilly Media, Inc.
Content preview from Learning Perl/Tk

Chapter 8. The Text Widget

When you think about what a text widget might do, you automatically think, "it displays text." This is true, yet it can do quite a bit more. The text widget is one of the most powerful standard widgets available in Perl/Tk. It is flexible, configurable, and easy to use for simple tasks. Here are some examples of how you can use text widgets:

  • Display and edit a plain text file.

  • Display formatted text from an HTML document.

  • Create a scrollable color key, with buttons that allow you change the colors

  • Gather multiline, formatted text (including colors) from a user (mini word processor).

  • Display text with different colors based on the input.

  • Make certain portions of text "clickable" and perform an action when clicked on. This could be HTML, or it could be similar to the widget demo.[1]

    [1] When you installed the Tk module with Perl, you also installed the widget demo. Type widget on the command line to see the capabilities of widgets in Perl/Tk.

You can put simple text, formatted text, and other widgets inside a text widget. A text widget can be used in conjunction with scrollbars to allow many pages of information to be viewed in much less space.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Perl/Tk

Mastering Perl/Tk

Stephen Lidie, Nancy Walsh

Publisher Resources

ISBN: 1565923146Supplemental ContentCatalog PageErrata