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 they take the tag or ID of the item(s) as a first argument. We say "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 replaces any currently set tags for the item. The taglist associated with -tags can also be empty, which will essentially remove all tags.
Copyright © 2002 O'Reilly & Associates. All rights reserved.