[Tutor] Tkinter event for changing OptionMenu items
klappnase at freenet.de
Thu Jul 21 20:07:28 CEST 2005
On Thu, 21 Jul 2005 12:19:00 -0400
Bernard Lebel <3dbernard at gmail.com> wrote:
> 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
> Any suggestion?
> var1 = StringVar()
> var1.set( aTables )
> oOptionMenu = OptionMenu( oRoot, var1, aTables, *aTables[1:] )
> sTableName = var1.get()
> oOptionMenu.bind( '<Return>', getTableColumns )
> oOptionMenu.pack( fill = X )
> Here the '<Return>' event is obviously not the one I'm looking for,
> but is there to illustrate what code I have so far.
if I understand you correctly, the "<Unmap>" event of the OptionMenu's Menu may be the best
bet for you (not very much tested though):
Otherwise you would probably have to call oOptionMenu['menu'].entryconfigure(command=...) on all menu entries.
I hope this helps
More information about the Tutor