Next / Previous / Contents / TCC Help System / NM Tech homepage

8.9. Canvas image objects

To display a graphics image on a canvas C, use:

    id = C.create_image(x, y, option, ...)

This constructor returns the integer ID number of the image object for that canvas.

The image is positioned relative to point (x, y). Options include:

Table 9. Canvas image options

activeimage Image to be displayed when the mouse is over the item. For option values, see image below.
anchor The default is anchor=tk.CENTER, meaning that the image is centered on the (x, y) position. See Section 5.5, “Anchors” for the possible values of this option. For example, if you specify anchor=tk.S, the image will be positioned so that point (x, y) is located at the center of the bottom (south) edge of the image.
disabledimage Image to be displayed when the item is inactive. For option values, see image below.
image The image to be displayed. See Section 5.9, “Images”, above, for information about how to create images that can be loaded onto canvases.
state Normally, image objects are created in state tk.NORMAL. Set this value to tk.DISABLED to make it grayed-out and unresponsive to the mouse. If you set it to tk.HIDDEN, the item is invisible.
tags If a single string, the image is tagged with that string. Use a tuple of strings to tag the image with multiple tags. See Section 8.4, “Canvas tags”.