The Widget Instance Command

For each instance of a widget, a new command is created that operates on that widget. This is called the widget instance command. Its name is the same as the Tk pathname of the widget. In the clock example, all that is done on instances is to query and change their attributes. Most of the work is done by Tk_ConfigureWidget and ClockConfigure, which are shown in the next section. The ClockInstanceCmd command procedure is shown in the next example:

Example 46-5 The ClockInstanceCmd command procedure.
 static int ClockInstanceCmd(clientData, interp, argc, argv) ClientData clientData;/* A pointer to a Clock struct */ Tcl_Interp *interp; /* The interpreter */ int argc; /* The number of arguments */ char *argv[]; /* The ...

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.