O'Reilly logo

Tcl/Tk in a Nutshell by Paul Raines, Jeff Tranter

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

Name

entry

entry pathName [option value...]

The entry command creates a new entry widget named pathName. An entry is a widget that displays a one-line text string that can be edited.

Standard Options

-background

-borderwidth

-cursor

-exportselection

-font

-foreground

-highlightBackground

-highlightcolor

-highlightthickness

-insertBackground

-insertborderwidth

-insertofftime

-insertontime

-insertwidth

-justify

-relief

-selectbackground

-selectborderwidth

-selectforeground

-setgrid

-takefocus

-xscrollcommand

  

Widget-Specific Options

-show char (show, Show)

Character to show instead of actual characters typed. Useful for password entries.

-state state (state, State)

State for the entry. State must be normal or disabled.

-width width (width, Width)

Desired width in characters. If zero or less, the width is made large enough to hold current text.

Text Indices

Several entry widget methods support the notion of an index for identifying particular positions within the line of text. Valid index values are as follows:

number

Character as a numerical index (starting from 0)

anchor

Anchor point for the selection

end

Character just after the last one in the entry's string

insert

Character just after the insertion cursor

sel.first

First character in the selection, if in entry

sel.last

Character just after last one in selection, if in entry

@x

Character at x-coordinate x in entry

Methods

pathName bbox index

Return a list of four numbers giving coordinates of upper-left corner (relative to the widget) and width and height of character at index ...

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