1import wx
2
3app = wx.App(False)
4frame = wx.Frame(None)
5
6menuBar = wx.MenuBar()
7menu = wx.Menu()
8menuBar.Append(menu, "&Menu")
9frame.SetMenuBar(menuBar)
10
11for name in ['foo','bar','baz']:
12 menuitem = menu.Append(-1,"&"+name,name)
13 def menuclick(e):
14 print(name)
15 frame.Bind(wx.EVT_MENU, menuclick, menuitem)
16
17frame.Show(True)
18app.MainLoop()
19