HyperlinkCtrl via Button

I’m trying to send a user to a hyperlink via a button click. I’ve found HyperlinkCtrl, and been able to print out a string for the link, but can’t find docs on how to tie it to a button.

HyperlinkEvent is popping up in google searches, but I can’t find docs or examples on how to link it to my button event.

If anyone has an example I could learn from or point me to the right docs that would be awesome, thank you!

Hello,

···

On Mar 6, 2009, at 7:54 PM, Jay Grenier wrote:

I'm trying to send a user to a hyperlink via a button click. I've found HyperlinkCtrl, and been able to print out a string for the link, but can't find docs on how to tie it to a button.

HyperlinkEvent is popping up in google searches, but I can't find docs or examples on how to link it to my button event.

If anyone has an example I could learn from or point me to the right docs that would be awesome, thank you!

If you just want to open up a link when a button is clicked this is much easier

import webbrowser

def OnButton(self, evt):
     webbrowser.open('http://google.com')

Cody

Indeed that is a heck of a lot easier. :slight_smile:

Thanks Cody.

···

On Fri, Mar 6, 2009 at 6:25 PM, Cody Precord codyprecord@gmail.com wrote:

Hello,

On Mar 6, 2009, at 7:54 PM, Jay Grenier wrote:

I’m trying to send a user to a hyperlink via a button click. I’ve found HyperlinkCtrl, and been able to print out a string for the link, but can’t find docs on how to tie it to a button.

HyperlinkEvent is popping up in google searches, but I can’t find docs or examples on how to link it to my button event.

If anyone has an example I could learn from or point me to the right docs that would be awesome, thank you!

If you just want to open up a link when a button is clicked this is much easier

import webbrowser

def OnButton(self, evt):

webbrowser.open('[http://google.com](http://google.com)')

Cody


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Jay Grenier wrote:

I'm trying to send a user to a hyperlink via a button click. I've found HyperlinkCtrl, and been able to print out a string for the link, but can't find docs on how to tie it to a button.

HyperlinkEvent is popping up in google searches, but I can't find docs or examples on how to link it to my button event.

If anyone has an example I could learn from or point me to the right docs that would be awesome, thank you!

In addition to what Cody said, you may also want to use the subprocess module. I've dealt with some websites that just won't load or won't load correctly in anything except Internet Explorer, so if you need to launch a specific browser rather than the default (which is what the webbrowser module does), subprocess is the way to go.

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Mike Driscoll wrote:

Jay Grenier wrote:

I'm trying to send a user to a hyperlink via a button click. I've found HyperlinkCtrl, and been able to print out a string for the link, but can't find docs on how to tie it to a button.

HyperlinkEvent is popping up in google searches, but I can't find docs or examples on how to link it to my button event.

If anyone has an example I could learn from or point me to the right docs that would be awesome, thank you!

In addition to what Cody said, you may also want to use the subprocess module. I've dealt with some websites that just won't load or won't load correctly in anything except Internet Explorer, so if you need to launch a specific browser rather than the default (which is what the webbrowser module does), subprocess is the way to go.

You could do use a specific browser with webbrowser too, I never done it but at least the doc says so.

get([name])
Return a controller object for the browser type name. If name is empty, return a controller for a default browser appropriate to the caller's environment.

Werner

Werner F. Bruhin wrote:

Mike Driscoll wrote:

Jay Grenier wrote:

I'm trying to send a user to a hyperlink via a button click. I've found HyperlinkCtrl, and been able to print out a string for the link, but can't find docs on how to tie it to a button.

HyperlinkEvent is popping up in google searches, but I can't find docs or examples on how to link it to my button event.

If anyone has an example I could learn from or point me to the right docs that would be awesome, thank you!

In addition to what Cody said, you may also want to use the subprocess module. I've dealt with some websites that just won't load or won't load correctly in anything except Internet Explorer, so if you need to launch a specific browser rather than the default (which is what the webbrowser module does), subprocess is the way to go.

You could do use a specific browser with webbrowser too, I never done it but at least the doc says so.

get([name])
Return a controller object for the browser type name. If name is empty, return a controller for a default browser appropriate to the caller's environment.

Werner

_________

Oops...I've never done that either, so I guess I forgot about it. Just ignore my babbling...

- Mike