How to open up a web browser?

Could anyone tell me how to open up a link / web browser from the game engine?

Here’s what I would like to learn how to do:

There’s a cube in the scene, I roll over it with the mouse, left click, and my browser pops up with a link to www.blender.org.

So, I know how to get the mouse to show & how to click on the cube to get some end result (ie color change, movement, etc). But is there some Actuator that I’m missing here, it seems like it should be so simple to click on a cube and have a link open in the web browser… maybe I’ve just skipped over it.

well, many thanks in advance!

Hi here is a little script for you:


import os
os.system('explorer www.google.com')

the only reason that works is because Explorer is in the systems Path= field.

If you wanted to launch the default browser, just include a URL link with your game, and use the above script like this:


 import os
 os.system('your shortcut name here')

make sure the URL shortcut is in the same directory/folder as your .blend file.
Be sure to launch blender by clicking on the .blend file, or you will get a file not found error.(dont use blenders built in file browser, it seems to get lost for some #$%^ing reason)

anyway! hope that helps you out :smiley:

To get the mouse to show, all you need is

 
import Rasterizer

r.showMouse(1) 

then, attach the script to a camera with an Always sensor, and Python controller

Python comes with a browser luancher that will launch the default browser, but there is specific code for linux/windows/mac:

Webbrowser Module:
http://docs.python.org/lib/module-webbrowser.html

Example:
import webbrowser
webbrowser.open_new(‘http://www.python.org’)