[Tutor] Open link in browser from mx Dialog

Alan Gauld alan.gauld at btinternet.com
Tue Jun 3 01:58:05 CEST 2008


"RaNaldo Shorter" <ranaldos at msn.com> wrote

> If you will, share the path or Internet reference that will allow me 
> to open
> a Web link from a mxPython dialog window.

I'm not sure what mxPython is but assuming it is closely related to
standard Python you might be able to use the standard webbrowser
module.

Failing that we will need more information about which OS you
are using, and possibly which browser you expect to open.

> My project is typical

Hmm, a typical Python project is hard to define. I've been using
Python for nearly 12 years now but have never actually needed
to open a web browser, yet... But obviously many do or there
would be no browser module in the library! :-)

> The code is attached. As you can see I've attempted and have not yet 
> the
> complete path or string.

OK, it seems that mxPython is probably a typo for wxPython.
The obvious fault in the code is the lack of parentheses after
webbrowser.open
In particular the docs suggest that the open call expects the url
as a parameter.

But it would help if you told us what error you get.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Tutor mailing list