opening a webpage with Renpy

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
kuroi
Regular
Posts: 129
Joined: Fri Jun 29, 2007 10:50 am
Location: Albuquerque, New Mexico, USA
Contact:

opening a webpage with Renpy

#1 Post by kuroi » Fri Jun 26, 2009 12:14 pm

I was thinking about the renpy help button today. That button opens an html help file in whatever browser the user has set as their default. Would it be possible to use this functionality to place a button into my game which would open my website in the user's browser instead?
President, Planner, and Programmer for Kuroi Games!

User avatar
killdream
Veteran
Posts: 325
Joined: Wed Nov 05, 2008 1:05 pm
Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
Deviantart: robotlolita
Github: robotlolita
Location: World's End (aka Brazil)
Contact:

Re: opening a webpage with Renpy

#2 Post by killdream » Fri Jun 26, 2009 12:33 pm

You can use the webbrowser module to launch it. Just import it on the init section and use the open function to launch whatever page in the default browser.

Code: Select all

init python:
    import webbrowser

label launch_mysite:
    $ webbrowser.open("http://www.mysite.com/")
If you get an error like ("module not found") it's because Ren'Py doesn't ship with this module, so you'll have to download it manually from Python's SVN and put on your game folder.

User avatar
kuroi
Regular
Posts: 129
Joined: Fri Jun 29, 2007 10:50 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: opening a webpage with Renpy

#3 Post by kuroi » Sat Jun 27, 2009 11:54 am

That's a ton! That's waaaaay easier than I thought it would be~
President, Planner, and Programmer for Kuroi Games!

User avatar
Jo'ogn
Veteran
Posts: 398
Joined: Sat Jul 12, 2008 1:31 pm
Projects: Kassiopeia [iVN]
Location: Deutschland
Contact:

Re: opening a webpage with Renpy

#4 Post by Jo'ogn » Sun Jun 28, 2009 1:42 pm

Wasn't there even just an {URL} tag for text?
Audio Plays: [original] The White Feathers Directive - [Star Wars] Through Flame and Shadow
Ren'Py: Kassiopeia [very interactive VN] work in progress - looking for proof reader english

Post Reply

Who is online

Users browsing this forum: Alex, Google [Bot], nyeowmi