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.
-background | -borderwidth | -cursor |
-exportselection | -font | -foreground |
-highlightBackground | -highlightcolor | -highlightthickness |
-insertBackground | -insertborderwidth | -insertofftime |
-insertontime | -insertwidth | -justify |
-relief | -selectbackground | -selectborderwidth |
-selectforeground | -setgrid | -takefocus |
-xscrollcommand |
char
(show
, Show
)Character to show instead of actual characters typed. Useful for password entries.
state
(state
,
State
)State for the entry. State
must be normal
or
disabled
.
width
(width
,
Width
)Desired width in characters. If zero or less, the width is made large enough to hold current text.
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 point for the selection |
| Character just after the last one in the entry’s string |
| Character just after the insertion cursor |
| First character in the selection, if in entry |
| Character just after last one in selection, if in entry |
@x | Character at
x-coordinate |
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
.
pathName
delete first
[last
]Delete range of characters starting at
first
up to, but not including,
last
. If
last
is omitted, only the character
at first
is deleted.
pathName
getReturn the entry’s current string.
pathName
icursor
index
Place the insertion cursor just before the character at
index
.
pathName
index
index
Return the numerical index corresponding to position
index
.
pathName
insert index
string
Insert string
just before the
position indicated by index
.
pathName
scan
dragto x
Scroll the widget’s view horizontally. The distance
scrolled is equal to 10 times the difference between this
command’s x
argument and the
x
argument to the last
scan mark command for the widget.
pathName
scan
mark x
Record x
as the anchor for a
following scan dragto method call.
pathName
selection
adjust index
Locate the end of the selection nearest to
index
, adjust that end of the
selection to be at index
, and make
the other end of the selection the selection anchor point. If
no current selection exists, the selection is created to
encompass the characters between
index
and the current anchor point,
inclusive.
pathName
selection
clearClear the selection if it is owned by this widget.
pathName
selection
from index
Set the selection anchor point to just before the
character at index
.
pathName
selection
presentReturn 1 if any characters in entry are currently selected, 0 otherwise.
pathName
selection
range start end
Set the selection to include characters starting at
start
up to, but not including, the
character at end
.
pathName
selection
to index
If index
is before the anchor
point, set the selection to the character range from
index
up to just before the anchor
point. If index
is after the anchor
point, set the selection to the character range from the
anchor point up to just before
index
.
pathName
xviewReturn a two-element list describing the currently visible horizontal region of the entry. The elements are real numbers representing the fractional distance that the view’s top and bottom edges extend into the vertical span of the widget.
pathName
xview
index
Adjust the visible region of the entry so the character
at index
is at the left edge of the
view.
pathName
xview
moveto fraction
Adjust the visible region of the entry so that the point
indicated by fraction
along the
widget’s horizontal span appears at the region’s left
edge.
pathName
xview
scroll number what
Shift the visible region of the entry horizontally by
number
. If
what
is units, then
number
is in units of the
characters. If what
is
pages
, then
number
is in units of the visible
region’s width.