Default event handlers in wxPython

Tom Wright tew24 at spam.ac.uk
Mon Jan 15 10:37:26 EST 2007


Hi all

I'm writing my first wxPython app and am having a problem with event
handlers.  I've set up a multi-part status bar and would like all the
tooltips, menu help strings etc. to go into the second part of it.  Is
there some easy way of doing this?

I've not found one, so have set up the following for the menu:

 self.Bind(wx.EVT_MENU_HIGHLIGHT, self.OnMenuHighlight)

def OnMenuHighlight(self, event):
 self.SetStatusText(event.GetEventObject().GetHelpString(event.GetMenuId()),
                                                                        1)

...this works fine.  I've tried to set up the same for the toolbar:

 self.Bind(wx.EVT_TOOL_ENTER, self.OnToolbarHighlight)
def OnToolbarHighlight(self, event):
self.SetStatusText(event.GetEventObject().GetToolLongHelp(event.GetSelection()),
 1)

...and this doesn't work.  Well, it puts the text in the second part of the
toolbar as requested, but the default handler is still being called and
this messes up the first part of the toolbar which I want it to leave
alone.  How do I completely override the default handler for the toolbar?
This method worked fine for menus and I'm a bit stuck.

(ignore the indentation on the above examples - I know it's wrong, but long
lines and usenet don't mix)


-- 
I'm at CAMbridge, not SPAMbridge



More information about the Python-list mailing list