Specifying Widget Attributes

Several of the fields in the Clock structure are attributes that can be set when the widget is created or reconfigured with the configure operation. The Tk_ConfigureWidget procedure is designed to help you manage the default values, their resource names, and their class names. It works by associating a widget option with an offset into the widget data structure. When you use a command line argument to change an option, Tk_ConfigureWidget reaches into your widget structure and changes the value for you. Several types are supported, such as colors and fonts, and Tk_ConfigureWidget handles all the memory allocation used to store the values. Example 46-9 shows the Tk_ConfigSpec type used to represent information about ...

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.