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

Peter Decker pydecker at gmail.com
Sun Sep 2 06:25:57 PDT 2007


On 9/2/07, david <decibels.2862 at charter.net> wrote:
> I have a HtmlWindow that I show tables of stock in. I thought a good way
> to minimize my menu selections would be to make the stock names and
> symbols links. Then can set a href in the html code to the stock symbol.
> Then when user clicks on the symbol, retrieve the href as a string. Then
> I can bring up a dialog to give the user choices.
>
> Just can't seem to get the href from the HtmlWindow as a string. The
> only examples have found (limited) is to subclass the HtmlWindow.
> Is that the only way to retrieve the href as a string so I know which
> symbol they clicked on? I guess could subclass, but prefer not to.
>
> SelectionToText might even work, but I have to click on the symbol
> Twice to get the string. Really just need one click.

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


-- 

# p.d.




More information about the wxpython-users mailing list