The Entry Widget

Create an entry widget with the Entry method. The value that the user has typed into the widget is stored in the variable pointed to by the -textvariable option.

$parent->Entry (options)

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

Other options are:

-show => x

Defines a character to be displayed in place of actual typed text (for use with passwords).

-textvariable => \$variable

Points to the variable containing text to be displayed in the entry widget. Button text will change as $variable does.

Text Indexes

In an Entry widget, several indexes are defined to identify positions in the entry text, for use by the methods used for retrieving or manipulating entry text. These indexes are:


An integer representing a character position, with 0 as the first character in the string.


The character directly after the insert cursor.


The first character in the selection block.


The character after the last character in the selection block.


The anchored position.


The position just after the last character in the entry string.

@ x

The character containing the specified x coordinate. ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.