Chapter 39. Fonts and Text Attributes

This chapter describes the naming conventions for fonts. Tk has a font object that you can dynamically configure and associate with widgets. This chapter also describes other text-related attributes such as justification, anchoring, and geometry gridding.

Fonts describe how characters look on the screen. Tk widgets like buttons, labels, and listboxes have a font attribute that determines which font they use to display their text. The text widget has font attributes on tags that are applied to different regions of text. Tk has a platform-independent way to name fonts (e.g., times 12 bold), plus it gracefully handles missing fonts. You can define named font objects and then associate those with widgets and ...

Get Practical Programming in Tcl & Tk, Third 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.