Listbox Style

The default -relief of a Listbox is 'sunken'. The default -borderwidth is 2. Figure 7-3 shows the five different relief types (flat, raised, ridge, groove, and sunken). In the first window, the default -borderwidth is used; in the second window, a -borderwidth of 4 is used. To save space in the windows, we didn’t draw any Scrollbars.

Examples of -relief and -borderwidth in Listboxes

Figure 7-3. Examples of -relief and -borderwidth in Listboxes

Style of Selected Items

There is also a border width associated with any selected text. This is controlled by the -selectborderwidthoption. Figure 7-4 shows what changing the selection border width to 4 does to the Listbox.

Example of -selectborderwidth => 4

Figure 7-4. Example of -selectborderwidth => 4

Get Mastering Perl/Tk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.