So I've been writing this application that works with files , and I wanted to add a list of recently opened files in the "File" menu and I came across a weird bug ..
Here's the sample code ..
for path in recentFilesList: item = wx.MenuItem(menu, wx.NewId(), path) self.Bind(wx.EVT_MENU, lambda(event):self.LoadRecent(path), item) menu.AppendItem(item()
so the problem is that the last lambda function gets bound to ALL the items added this way ..
so for instance , if
recentFileList[-1] = "C:\Last\File\Path"
clicking on any of those items
gets called ..
Am I missing something , or is this just a bug ?