beetlebug▾
/

canvas index

Gives the number of a place in a text item, or of a coordinate of a line or a polygon.

PATHNAME index TAGORID INDEX

Description

For a text item, INDEX is a number, end, insert, sel.first, sel.last, or @X,Y. For a line or a polygon, the index counts the coordinates, and end is the count of the coordinates.

Returns

An integer.

Examples

% canvas .ix
> .ix create text 0 0 -text abc
> .ix index 1 end
3

Errors

% canvas .ix2; .ix2 index 1 end
can't find an indexable item "1"
-errorcode NONE

% canvas .ix3; .ix3 create text 0 0 -text abc; .ix3 index 1 bogus
bad index "bogus"
-errorcode NONE

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also