menu wxpython callback stackoverflow
def menuclick(e):
print(menu.FindItemById(e.Id).Label)
Lovely Louse
def menuclick(e):
print(menu.FindItemById(e.Id).Label)
import wx
app = wx.App(False)
frame = wx.Frame(None)
menuBar = wx.MenuBar()
menu = wx.Menu()
menuBar.Append(menu, "&Menu")
frame.SetMenuBar(menuBar)
for name in ['foo','bar','baz']:
menuitem = menu.Append(-1,"&"+name,name)
def menuclick(e):
print(name)
frame.Bind(wx.EVT_MENU, menuclick, menuitem)
frame.Show(True)
app.MainLoop()