Colors and Fonts
Tk was originally created for the X Window System and is still primarily used in that environment. For this reason, it has inherited the font and color scheme used for the X Window System.
Colors that can be used with Tk widgets are identified either by an RGB value or by a name that has been associated with an RGB value. In general, it is easier to use a color name than an explicit RGB value. For a listing of the color names that are supported, see the rgb.txt file in your X distribution or use the showrgb command. (Most common color names are supported, so you can say things such as “red,” “pink,” “green,” and even “chartreuse” with confidence.)
Fonts are another matter. Under the X Window System, fonts are
named things such as -adobe-helvetica-medium-o-normal --
12-120-75-75-p-67-iso8859-1. Wildcards can make the fonts
easier to use, but they’re still a mouthful. For a listing of fonts
available for a particular X server, use the
xlsfonts command. There are a few font
“aliases” that have been defined for your convenience (such as
fixed
, 6x10
, 9x15
, etc.), and you might prefer to just
stick to those.
Get Perl in a Nutshell, 2nd Edition 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.