Python vs. Tcl implimention question/comparison.

Chuck Meyers chuck.meyers at lmco.com
Tue Aug 22 16:04:56 EDT 2000


I prefer Python to Tcl, it has many advantages I'm sure you are aware
of.
But I have come across a case where it seems that Tcl has a much cleaner

solution. I want to add a context sensative HELP to my GUIs. One way to
do
this is to generate a binding to all widgets that calls a HELP procedure

passing the calling widget name. In Tcl you have the %W variable to pass

as a parameter, thus you only need to add a few lines of code and all
widgets have HELP. You need to maintain the HELP procedure that gets
called,
but when making widgets you can ignore the fact that HELP exists. In
Python it seems the best solution is to have a global variable that
contains the calling widget name, but setting it would mean you would
have
to explicitly add code to each widget binding.

Another Tcl advantage is the naming convention. The %W name tells you
the
parents name, so if help is not available for the widget, you could
search
for help for the parent widget.

Is there a clean way to get the widget name and parents names in Python
without having to add code to each widget?




More information about the Python-list mailing list