Dynamic Event Handling in wxPython
sandorlevi at yahoo.com
Thu Sep 26 13:54:17 CEST 2002
id = event.GetId()
# ...your code here...
"Mikey at Work" <itsmikeytime at hotmail.com> wrote in message news:<amt348$2pl$1 at news-int.gatech.edu>...
> I'm trying to design a menu in wxPython that connects to an SQL server to
> get its menu commands. So far, I've been able to display the records from
> the SQL server in the menu. The problem, however, occurs when I try to
> connect event handlers to the menu items. I know how to connect the event
> handlers (I'm either going to use EVT_MENU_RANGE or assign a EVT_MENU to
> each menu item when the items refresh from the server), but the function
> called by the event handler has no way of determining the id of the menu
> item (at least as far as I know).
> If I use...
> EVT_MENU_RANGE(lowID, highID, OnMenuSelection)
> ... OnMenuSelection doesn't know which menu item was selected. Is there a
> way to pass the menu item's id to the function OnMenuSelection or retrieve
> the id in the function? Thanks for your help. I'm sorry if some of my
> terminology is off -- I'm kinda new to Python and programming in general.
More information about the Python-list