wxPython get event ID

﹥>﹥吖頭↗ 提交于 2019-12-13 02:09:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!