1ttk_image(n) Tk Themed Widget ttk_image(n)
2
3
4
5______________________________________________________________________________
6
8 ttk_image - Define an element based on an image
9
11 ttk::style element create name image imageSpec ?options?
12_________________________________________________________________
13
15 The image element factory creates a new element in the current theme
16 whose visual appearance is determined by Tk images. imageSpec is a
17 list of one or more elements. The first element is the default image
18 name. The rest of the list is a sequence of statespec / value pairs
19 specifying other images to use when the element is in a particular
20 state or combination of states.
21
23 Valid options are:
24
25 -border padding
26 padding is a list of up to four integers, specifying the left,
27 top, right, and bottom borders, respectively. See IMAGE
28 STRETCHING, below.
29
30 -height height
31 Specifies a minimum height for the element. If less than zero,
32 the base image's height is used as a default.
33
34 -padding padding
35 Specifies the element's interior padding. Defaults to -border
36 if not specified.
37
38 -sticky spec
39 Specifies how the image is placed within the final parcel. spec
40 contains zero or more characters “n”, “s”, “w”, or “e”.
41
42 -width width
43 Specifies a minimum width for the element. If less than zero,
44 the base image's width is used as a default.
45
47 If the element's allocated parcel is larger than the image, the image
48 will be placed in the parcel based on the -sticky option. If the image
49 needs to stretch horizontally (i.e., -sticky ew) or vertically (-sticky
50 ns), subregions of the image are replicated to fill the parcel based on
51 the -border option. The -border divides the image into 9 regions: four
52 fixed corners, top and left edges (which may be tiled horizontally),
53 left and right edges (which may be tiled vertically), and the central
54 area (which may be tiled in both directions).
55
57 set img1 [image create photo -file button.png]
58 set img2 [image create photo -file button-pressed.png]
59 set img3 [image create photo -file button-active.png]
60 style element create Button.button image \
61 [list $img1 pressed $img2 active $img3] \
62 -border {2 4} -sticky we
63
65 ttk::intro(n), ttk::style(n), ttk_vsapi(n), image(n), photo(n)
66
68 style, theme, appearance, pixmap theme, image
69
70
71
72Tk 8.5 ttk_image(n)