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

python at bdurham.com python at bdurham.com
Sun Nov 21 18:44:20 CET 2010


Hi Michael(s):

> 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

This fails in 32-bit Python 2.7 for Windows (linked to Tk 8.5 with
ttk/Tile).

Malcolm


More information about the Tkinter-discuss mailing list