Tkinter Menus

Tim Daneliuk tundra at tundraware.com
Wed Dec 11 20:10:07 EST 2002


I have a working Tkinter Menubutton/Menu pair.  I am associating the same
function (command) with each entry in the menu.  What I cannot seem to find
a way to do is have this single function determine which menu item was
actually selected so it can act accordingly.

The reason I need to do things this way is that the menu contents is
determined at runtime and can vary.  It is therefore not practical to
have a separate function for each menu entry since I don't know ahead
of time how many there will be and what they will be doing ... the association
between a menu item and corresponding action will be defined by the user
in a configuration file which is read at startup (and which is not written
in Python).

What am I missing here? ... (Probably something obvious.)
-- 
------------------------------------------------------------------------------
Tim Daneliuk
tundra at tundraware.com




More information about the Python-list mailing list