Listbox Options
As with any of the widgets, you can configure the Listbox using
options. The standard widget options are -cursor
,
-font
, -height
,
-highlightbackground
,-highlightcolor
,
-highlightthickness
,
-takefocus
, -width
,
-xscrollcommand
, and
-yscrollcommand
. The options specific to Listbox
widgets will be further discussed later in this chapter.
-
-background =>
color
Sets the color of the area behind the text.
-
-borderwidth =>
amount
Sets the width of the edges of the widget. Default is 2.
-
-cursor =>
cursorname
Sets the cursor to display when the mouse is over the Listbox.
-
1
Determines if the current Listbox selection is made available for the X selection as well. If set to 1, prevents two Listboxes from having selections at the same time.
-
-font =>
fontname
Sets the font of any text displayed within the Listbox.
-
-foreground =>
color
Sets the color of nonselected text displayed in the Listbox.
-
-height =>
amount
Sets the height of the Listbox.
-
-highlightbackground =>
color
Sets the color the highlight rectangle should be when the Listbox does not have the keyboard focus.
-
-highlightcolor =>
color
Sets the color the highlight rectangle should be when the Listbox does have the keyboard focus.
-
-highlightthickness =>
amount
Sets the thickness of the highlight rectangle. Default is 2.
-
-relief => 'flat'|'groove'|'raised'|'ridge'|'
sunken
'|'solid'
Sets the relief of the edges of the Listbox.
-
-selectbackground =>
color
Sets the color behind any selected ...
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.