Tk Commands is a list of commands that are built-in to Tk.
In Tk 8.5, the Ttk package becomes a part of the Tk distribution. Special information on some of these tile/ttk widgets:
Reserved variables are (incomplete):
There are also some environment variables.
tklib's widget package contains the following megawidgets:
Many third-party widgets are Snidgets. See that page for a list of Snidgets.
** Internal Variables
Note that in Tk, one has several ways one can control visual aspects of widgets:
[are there other ways of influencing these?]
One must be certain to keep some things in mind when writing widget code:
It's also not a good idea at all to start a widget name part with a capital letter (because that style of name is reserved for the names of widget classes, and you *really* don't want to get those two mixed up.) But it's usually really easy to start with a lower-case letter and use alphanumeric for the rest...
[Using :: as characters in a widgets name as a] problem is much more difficult to get around for megawidget authors than the space one. Properly treating things as lists solves the space problem. However, the use of namespaces for megawidget building is common in order to encapsulate code / hide the ickies from the user. That conflicts with the use of ::. It is possible to rename the :: parts when you use namespaces, but then it becomes cumbersome to map back and forth.
RS: As each widget defines a command with its name, can't interp aliases be used to map fancy to real names? E.g.
interp alias {} foo::bar {} .top.frame1.bar.canvas
LV: So, if someone has a string that they are certain is a name of a widget, is there introspection that can be used to determine what widget it is?
escargo 2005-08-16: I would expect winfo exists should be able to answer that question.
LV: winfo exists just tells me if the widget exists - not what kind of a widget it is. Thanks!
MG: How about winfo class $widgetName?
LV: That seems like it should work - thanks!
RS 2006-04-28: Here's a little helper to retrieve the default value of a widget attribute (use long names (-background) instead of the short ones (-bg)):
% proc get'default {w flag} {lindex [$w config $flag] 3} % get'default $t -font {MS Sans Serif} 8
The current value is of course returned by the cget method:
% $t cget -font Courier 9