The Text Widget

Create a text widget with the Text method:

$parentwidget->Text ( options)

The standard configuration options that apply to Text are: -background, -bg, -borderwidth, -bd, -cursor, -exportselection, -font, -foreground, -fg, -height, -highlightbackground, -highlightcolor, -highlightthickness, -insertbackground, -insertborderwidth, -insertofftime, -insertontime, -insertwidth, -padx, -pady, -relief, -selectbackground, -selectborderwidth, -selectforeground, -state, -takefocus, -width, -xscrollcommand, and -yscrollcommand.

Other options are:

-setgrid => boolean

Turns on gridding for the text widget. Default is 0 (off).

-spacing1 => amount

Defines the amount of space left on the top of a line of text that starts on its own line. Default is 0.

-spacing2 => amount

Defines the amount of space left on the top of a line of text after it has been automatically wrapped by the text widget. Default is 0.

-spacing3 => amount

Defines the amount of space left after a line of text that has been ended by "\n“. Default is 0.

-tabs => list

Specifies a list of tab stops to use in the text widget. Default is undefined (no tab stops).

-wrap => mode

Sets the mode for determining automatic line wrapping. Values are "none" (no wrapping), "char" (wrap at any character), or "word" (wrap at a word boundary). Default is "char".

Text Indexes and Modifiers

In a Text widget, several indexes are defined to identify positions in the text widget, for use by the methods used for retrieving or manipulating ...

Get Perl in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.