问题
I have some code, which binds a menu item to a method:
def getEventID(self, event):
print id # how do I get id?
EVT_MENU(self, 123, self.getEventID)
So basicly, I want my app to print "123" when the menu item with that ID is pressed. How would I do that?
回答1:
You should just be able to use event.GetId()
I believe. You can also use event.GetEventObject()
to get the widget that fired the event.
来源:https://stackoverflow.com/questions/6791676/wxpython-get-event-id