The resource specification is a specification for the containing widget, for which the specification is applied. It is formatted roughly similar to a Tcl script, with each line being either:
-<option> <value>
or
cmd arg arg...
Options will be given to the containing widget.
Currently cmd can be either pack, wm, or a Tk widget (like button).
Command spec for pack:
pack options
Where options is a list of options, as if given to the pack Tk command for
the containing widget.
Command spec for wm: wm resourceSpec
Where resourceSpec is a list of sub commands, each representing a wm
command for the containing widget.
The command spec for widgets is: type name resourceSpec
type is a Tk widget which will be created.
name is the sub-name of the widget (it will be created as a child of the containing widget).
resourceSpec is the resource specification as described above.
The resoure specification will be run through with subst before processing inside a
unique namespace. Variables can be passed in along with the build and
buildFromFile commands.
Example
toplevel monthTotals {
-class Dialog
frame buttons {
button prev {
-text "Previous Month"
pack {
-side left
}
}
button next {
-text "Next Month"
pack {
-side left
}
}
pack {}
}
wm {
title "Month Totals"
minsize 400 500
}
}
That resource specification will create a new toplevel (under whatever
Tk widget is passed to build or buildFromFile) with the Dialog class.
It will contain a frame called buttons with two buttons packed within it.
It will be given a title of "Month Totals" and be set to a minimum size
of 400x500.