[wxPython] wxHtmlWindow.OnLinkClicked revisited

I've read several times that the proper way to intercept link clicks in an wxHtmlWindow is to subclass wxHtmlWindow and define OnLinkClicked. Unfortunately, that's not getting called for me. Am I missing something obvious?

I've tested this on wxGTK 2.3.1 and wxGTK 2.2.8 (via debian woody).

class MyHtmlWindow(wxHtmlWindow):
  def __init__(self, instance, *args, **params):
    self.instance = instance
    wxHtmlWindow.__init__(self, *args, **params)

  def OnLinkClicked(self, event):
    print "Something happened"
    # Specific stuff

class MyApp(wxApp):
    <snip>
    self.htmlpanel = MyHtmlWindow(self, self.frame, -1)
    <snip>

The MyHtmlWindow creates correctly and displays my text as I'd expect. But when I click a link, the OnLinkClicked is never called and I just get a dialog telling me "Unable to open requested HTML document xxxx". (I'm using this as a menu-type system, so the URLs are not valid web urls).

Hopefully, this is as simple as I need new eye glasses :slight_smile:

Thanks,

Jason Cater

I've read several times that the proper way to intercept link clicks in an

wxHtmlWindow is to subclass wxHtmlWindow and define OnLinkClicked.
Unfortunately, that's not getting called for me. Am I missing something
obvious?

Compare what you are doing with what's in the demo. It works there.

···

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