[Tutor] Tkinter event for changing OptionMenu items

jfouhy@paradise.net.nz jfouhy at paradise.net.nz
Fri Jul 22 01:40:51 CEST 2005


Quoting Bernard Lebel <3dbernard at gmail.com>:

> I'm trying to bind an event to the changes made to an OptionMenu. Ie
> the user chooses a different item, the rest of the Tk window gets
> updated. To repopulate the window, a function would be called by the
> binding.
> 
> Any suggestion?

The easiest way is to use a Pmw.OptionMenu, which has this functionality
built-in :-)

Alternatively, you can trace the StringVar you connect to the OptionMenu.  I
have never done anything with traces, but there are some instructions here:
http://www.astro.washington.edu/owen/ROTKFolklore.html

-- 
John.


More information about the Tutor mailing list