O'Reilly logo

Mastering Perl/Tk by Nancy Walsh, Stephen Lidie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tile and Transparent Images

Like the -background color option, most widgets support a -tile option, as shown in Figure 17-18.

A 32x32 PNG file, tile.png

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, where side can be n, ne, e, se, s, sw, w, nw, or center. 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 -offset option is used for stippling as well. For line and polygon Canvas items, you can also specify an index as an argument, which connects the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required