Default event handlers in wxPython

T

Tom Wright

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top