[Tkinter-discuss] How do I identify which menu item has bee selected?

thicket mark_eastwood at ntlworld.com
Tue Aug 18 13:44:25 CEST 2009

Hi - am using python 2.6 and Tkinter 8.5.

I would like to know how to identify which 'menu item' has been selected
from a cascaded menu.  

The cascaded menu menu items are variable and created on the fly. The idea
is to use a common callback for all menu items, the callback function then
determines which selection was made and runs the appropriate function.

I have tried binding an event to the selection and then trying to get some
sort of info from the event object (event.widget()) but this appears to
return info about the menu class instance and not about it's menu items.  

I've used Java in the past - and if I recall correctly - a menu-item is a
class, in python it seems to be an attribute(list entry) of the menu class -
in which case - how do I interrogate it if I do not know it's index?

Any help is appreciated - it's starting to do my head in!!
View this message in context: http://www.nabble.com/How-do-I-identify-which-menu-item-has-bee-selected--tp25023156p25023156.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.

More information about the Tkinter-discuss mailing list