Hi there
I have an application in which Menubar and context menus are created and destroyed many times at run-time. I recently noticed that Unbind(wx.EVT_MENU)
always fails, where many ids are bound to it. Is it possible to unbind all handlers bound to wx.EVT_MENU
all at once?
To demonstrate it,
import wx
from wx.py.shell import Shell
app = wx.App()
frm = wx.Frame(None)
if 1: # Add some local vars to the shell.
frm.self = frm
frm.this = __import__('__main__')
frm.shell = Shell(frm, locals=frm.__dict__)
frm.Show()
app.MainLoop()
Note the shell has a context-menu for copy, paste, etc.
If the id is given explicitly, it works and the handler for the ID_COPY
menu is removed.
>>> self.shell.Unbind(wx.EVT_MENU, id=self.shell.ID_COPY)
True
But,
>>> self.shell.Unbind(wx.EVT_MENU)
False