Indices

Many of the widget commands for entries take one or more indices as arguments. An index specifies a particular character in the entry's string, in any of the following ways:

number
Specifies the character as a numerical index, where 0 corresponds to the first character in the string.
anchor
Indicates the anchor point for the selection, which is set with the select from and select adjust widget commands.
end
Indicates the character just after the last one in the entry's string. This is equivalent to specifying a numerical index equal to the length of the entry's string.
insert
Indicates the character adjacent to and immediately following the insertion cursor.
sel.first
Indicates the first character in the selection. It is an error to use this form if the selection isn't in the entry window.
sel.last
Indicates the character just after the last one in the selection. It is an error to use this form if the selection isn't in the entry window.
@number
In this form, number is treated as an x-coordinate in the entry's window; the character spanning that x-coordinate is used. For example, ``@0'' indicates the left-most character in the window.

In general, out-of-range indices are automatically rounded to the nearest legal value.


© Author | Home | Sitemap