7.5. 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.
Figure 7-3. Examples of -relief and -borderwidth in Listboxes
7.5.1. Style of Selected Items
There is also a border width associated with any selected text. This is controlled by the -selectborderwidth option. Figure 7-4 shows what changing the selection border width to 4 does to the Listbox.
Figure 7-4. Example of -selectborderwidth => 4
7.5.2. Special Listbox Resizing
The -setgrid option changes how the window is drawn when it's resized. Using -setgrid => 1 causes the window to stay resized to the grid created by the Listbox widget. Essentially, this means that the Listbox will display only complete lines (no half lines) and complete characters. A side benefit is that the Listbox will always display at least one line and will remain in sight when the visible window is resized. This option has nothing to do with which geometry manager you use to put the Listbox in the window.
Copyright © 2002 O'Reilly & Associates. All rights reserved.