Skip to Main Content
Learning Perl/Tk
book

Learning Perl/Tk

by Nancy Walsh
January 1999
Beginner content levelBeginner
373 pages
9h 43m
English
O'Reilly Media, Inc.
Content preview from Learning Perl/Tk

9.8. Configuring Items in the Canvas Widget

To change the configuration options of any of the items within the canvas, you only need to know the tag name or the ID for that item. You can then use the itemcget and itemconfigure methods. They behave just like the cget and configure methods, except as a first argument, they take the tag or ID of the item(s). I use the term "item(s)" because a tag can refer to more than one item. Here are some examples:

$color = $canvas->itemcget("circle", -fill);
$canvas->itemconfigure($id_number, -fill => "yellow", -outline => 5);

Make sure the options you use with itemconfigure and itemcget are valid. Each item type has a list of valid options; they are listed earlier in this chapter with each create method.

When you set the -tags option, the itemconfigure method will replace any currently set tags for the item. The taglist associated with -tags can also be empty, which will essentially remove all tags.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Perl/Tk

Mastering Perl/Tk

Stephen Lidie, Nancy Walsh

Publisher Resources

ISBN: 1565923146Supplemental ContentCatalog PageErrata