[ltk-user] custom styles for tiled Tk [patch]

Peter Herth herth at peter-herth.de
Sat Jun 6 15:55:07 UTC 2009


Hallo Daniel,

indeed, ttk style support is not in LTk yet, but I am happy about your
contributions there. Unfortunately, finding out about all the Tk 8.5
changes is a bit of guesswork in absence of some overview
documentation...  but the link you posted should help a bit.

The initargs seems indeed to be black voodoo - perhaps it actually is
:). But you did it exactly right.
To explain the concept of the system:

- defargs tells LTk which arguments/parameters a widget takes.
- the list *initargs* describes how the single parameters should be
handled when passing them
to Tk. By default it inded prints the content lowercased - that works
usually quite well as most
literal arguments Tk takes are lowercased strings. So with this format
directive you can just use
Lisp keywords as in (pack :side :left)
For parameters where this is not desired, you have to give the fitting
definition as you did. This
definition applies for all widgets, which have a "style" parameter.
The format of the definition has four elements:
1) the internal name by which the parameter is looked up
2) the name used for the corresponding keyword parameter e.g. for
initalize-instance
3) the format string for formatting the parameter
4) a lisp form that is evaluated and passed to format for consumption
by the format string in 3)

so 4) is either 2) or an expression of 2)
1) is mostly also 2) but sometimes not, if different widget need to
implement the parameter with different
format statements. See for example that there is a separate cbcommand,
which creates a command parameter for the check-button, as in contrast
to the command parameter for the plain button, the created callback
gets the value of the widget passed.

I hope that helps...
Peter




More information about the ltk-user mailing list