O'Reilly logo

Mastering Perl/Tk by Nancy Walsh, Stephen Lidie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. The Text, TextUndo,and ROText Widgets

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. You can use Text widgets to:

  • 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 (act as a mini word processor)

  • Display text with different colors based on the input

  • Create hypertext windows that perform actions when clicked (either HTML or similar to the widget demo).[1]

You can put text as well as 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.

[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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required