1image(n) Tk Built-In Commands image(n)
2
3
4
5______________________________________________________________________________
6
8 image - Create and manipulate images
9
11 image option ?arg arg ...?
12______________________________________________________________________________
13
15 The image command is used to create, delete, and query images. It can
16 take several different forms, depending on the option argument. The
17 legal forms are:
18
19 image create type ?name? ?option value ...?
20 Creates a new image and a command with the same name and returns
21 its name. type specifies the type of the image, which must be
22 one of the types currently defined (e.g., bitmap). name speci‐
23 fies the name for the image; if it is omitted then Tk picks a
24 name of the form imagex, where x is an integer. There may be
25 any number of option-value pairs, which provide configuration
26 options for the new image. The legal set of options is defined
27 separately for each image type; see below for details on the
28 options for built-in image types. If an image already exists by
29 the given name then it is replaced with the new image and any
30 instances of that image will redisplay with the new contents.
31 It is important to note that the image command will silently
32 overwrite any procedure that may currently be defined by the
33 given name, so choose the name wisely. It is recommended to use
34 a separate namespace for image names (e.g., ::img::logo,
35 ::img::large).
36
37 image delete ?name name ...?
38 Deletes each of the named images and returns an empty string.
39 If there are instances of the images displayed in widgets, the
40 images will not actually be deleted until all of the instances
41 are released. However, the association between the instances
42 and the image manager will be dropped. Existing instances will
43 retain their sizes but redisplay as empty areas. If a deleted
44 image is recreated with another call to image create, the exist‐
45 ing instances will use the new image.
46
47 image height name
48 Returns a decimal string giving the height of image name in pix‐
49 els.
50
51 image inuse name
52 Returns a boolean value indicating whether or not the image
53 given by name is in use by any widgets.
54
55 image names
56 Returns a list containing the names of all existing images.
57
58 image type name
59 Returns the type of image name (the value of the type argument
60 to image create when the image was created).
61
62 image types
63 Returns a list whose elements are all of the valid image types
64 (i.e., all of the values that may be supplied for the type argu‐
65 ment to image create).
66
67 image width name
68 Returns a decimal string giving the width of image name in pix‐
69 els.
70
71 Additional operations (e.g. writing the image to a file) may be avail‐
72 able as subcommands of the image instance command. See the manual page
73 for the particular image type for details.
74
76 The following image types are defined by Tk so they will be available
77 in any Tk application. Individual applications or extensions may
78 define additional types.
79
80 bitmap Each pixel in the image displays a foreground color, a back‐
81 ground color, or nothing. See the bitmap manual entry for more
82 information.
83
84 photo Displays a variety of full-color images, using dithering to
85 approximate colors on displays with limited color capabilities.
86 See the photo manual entry for more information.
87
89 bitmap(n), options(n), photo(n)
90
92 height, image, types of images, width
93
94
95
96Tk 4.0 image(n)