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

Colors

In most widgets, there is a -background and a -foreground color. In addition to those, we also have the -selectbackground and -selectforeground color options in a Listbox. When a Listbox entry is selected, it appears in a different color.

Although you can change the color of the selected text, you can use only one color. You cannot make different lines in the Listbox different colors.

In Figure 7-2, the Listbox on the left has -foreground => 'red', -background => 'green'. The Listbox on the right has -selectforeground => 'red', -selectbackground => 'green'. Make sure the foreground and background values contrast with each other if you change these options.

Examples of -foreground, -background, -selectforeground, and -selectbackground

Figure 7-2. Examples of -foreground, -background, -selectforeground, and -selectbackground

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