Determining Item Type

To determine an item’s type, call the typemethod:

$canvas->type(tag/id);

If the tag or ID matches more than one item, only the type of the first item is returned. The returned value will be a string describing the item type: "oval", "text", "rectangle", and so on.

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