O'Reilly logo

Practical Programming in Tcl & Tk, Third Edition by Brent B. Welch

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

Naming a Font

There are two basic ways to name a font. You can use predefined font names (e.g., system), or you can specify a set of font attributes with a platform-independent name:

label .foo -text "Hello" -font {times 12 bold}

In this form, the font is specified with a three element list. The first element is the font family, the second is the size, in points, and the third is a list of style parameters. The family determines the basic look, such as courier or helvetica.

The complete set of style parameters are normal, bold, roman, italic, underline, and overstrike. For example, to specify both bold and italic:

label .foo -text "Hello" -font {times 12 {bold italic}}

The font size is points, which are 1/72 inch. Tk maintains a scale factor ...

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