[Patches] Tkinter OptionMenu callback

Guido van Rossum guido@python.org
Thu, 24 Feb 2000 15:30:27 -0500


Nice, it seems that Pmw's OptionMenu has the same functionality.

Two comments on the patch:

(1) Shouldn't the _setit() class set the variable before calling the
callback?  I think that makes more sense; the callback might want to
call something else that gets the new value from the Tcl variable
rather than using the callback argument.

(2) You should check that the only kw arg accepted is 'command'.  The
current code silently ignores other kw args, which is very un-Tk-ish.
(I would also undo the rename of the 'kw' dict -- now it took me a
while to figure out why the first 4 lines of the body of the __init__
were changed.  Give the ** argument a different name, since it's
totally new; e.g. **kwargs.

I noticed that you didn't include the legal boilerplate <2.0 wink>.

--Guido van Rossum (home page: http://www.python.org/~guido/)