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

Get Tcl/Tk 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.