The Tcl command that creates an instance of a widget is known as the class command. In our example, the clock command creates a clock widget. The command procedure for clock follows. The procedure allocates the Clock data structure. It registers an event handler that gets called when the widget is exposed, resized, or gets the focus. It creates a new Tcl command that operates on the widget. Finally, it calls ClockConfigure to set up the widget according to the attributes specified on the command line and the default configuration specifications.
int ClockCmd(clientData, interp, argc, argv) ClientData clientData; /* Main window of the app */ Tcl_Interp *interp; /* Current interpreter. ...