[wxPython-users] Get href from wx.html.HtmlWindow as a string.

david decibels.2862 at charter.net
Sun Sep 2 14:09:58 PDT 2007


> From: Peter Decker
>
> Bind to the wx.html.EVT_HTML_LINK_CLICKED event:
>
> self.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.onLink)
>
> def onLink(self, event):
>    href = event.href

Thanks Peter, but still doesn't work here.  For the above I get this error:
Traceback (most recent call last):
  File "main.py", line 320, in onLink
    href = event.href
AttributeError: 'HtmlLinkEvent' object has no attribute 'href'

But you put me in the right ballpark. :) This does work. I get the href
string the way I want it:

def onLink(self, event):
    testlink = event.GetLinkInfo().Href
    print testlink

Working like a charm. I had something close before, but  must have 
been all around it. I also tried this after getting it working and they 
work also:

testlink = event.GetLinkInfo().GetHref()

Looks like I have what I wanted now. Thanks a lot!!

Dave




> I have a HtmlWindow that I show tables of stock in. I thought a good way




More information about the wxpython-users mailing list