Tile and Transparent Images
Like
the -background color option, most widgets support
a -tile option, as shown in Figure 17-18.
Figure 17-18. A 32x32 PNG file, tile.png
A tile is an
image, typically small, patterned repeatedly across and down the
widget. If a widget has both a -background and
-tile option, the tile is applied over the
background color, hence it takes precedence. Currently, the Button,
Canvas, Checkbutton, Entry, Frame, Label, Listbox, MainWindow, Menu,
Menubutton, Message, Radiobutton, Scale, Scrollbar, Text, and
Toplevel widgets support the -tile option. Here
are the common tile-related widget options:
-
-activetile =>image Specifies the tile image displayed when drawing an active widget.
-
-disabledtile =>image Specifies the tile image displayed when drawing a disabled widget.
-
-offset => offsetSpec Specifies the offset of the tiles. It can have two different formats,
-offset => [x, y]or-offset =>side, wheresidecan ben,ne,e,se,s,sw,w,nw, orcenter. In the first case, the origin is that of the Toplevel of the current window. For a Canvas and Canvas items, the origin is the Canvas origin, but putting a#character in front of the coordinate pair means use the Toplevel origin instead. For Canvas items, the-offsetoption is used for stippling as well. For line and polygon Canvas items, you can also specify an index as an argument, which connects the ...
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.
Read now
Unlock full access