wx.MenuBar Event

Hello,

why can’t I bind an event to the wx.MenuBar?

self.Bind(wx.EVT_MENU,
self.handler.help_wiki, id=self.WIKI)

parent.Bind(wx.EVT_MENU, self.handler.help_wiki, id=self.WIKI)

“parent” is a wx.Frame in this case and it only works for
the parent.bind - but why?

Thank You!

Johannes Schönberger wrote:

Hello,

why can't I bind an event to the wx.MenuBar?

self.Bind(wx.EVT_MENU, self.handler.help_wiki, id=self.WIKI)
parent.Bind(wx.EVT_MENU, self.handler.help_wiki, id=self.WIKI)

"parent" is a wx.Frame in this case and it only works for the parent.bind - but why?

Because menu events are not delivered to the menubar, but directly to the frame that owns the menubar. There probably isn't any technical reason for this other than this is the way it has always been done in wx.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!