[Tkinter-discuss] Looking for example of how to use <<MenuSelect>> to determine currently selected menu item

Michael O'Donnell michael.odonnell at uam.es
Sun Nov 21 13:05:49 CET 2010


Hi Michael,

At least in Python 2.5.4 linked to Tk 8.4 (Windows version),
the following fails  because event.widget holds a string (the tcl/tk
widget name), not a Tkinter class.

> def callback(event):
>    print event.widget.index('active')

Maybe fixed in later editions, but if one wants a solution that will
work on older versions...

Mick


More information about the Tkinter-discuss mailing list