Open a URL

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
jack_norton
Lemma-Class Veteran
Posts: 4028
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Open a URL

#1 Post by jack_norton » Wed Oct 01, 2008 11:41 am

I didn't see any option to open a URL from renpy so I guess the only solution is to use python... I found several libraries to open URLs, can anyone give me a suggestion which method is hte best one?
Actually I had already the solution in summer session demo sources but I accidentally deleted them :oops:
follow me on Image Image Image Image
computer games

User avatar
PyTom
Ren'Py Creator
Posts: 15437
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Open a URL

#2 Post by PyTom » Wed Oct 01, 2008 11:47 am

There are two ways of opening urls in Ren'Py.

If you just want to include a hyperlink in text, write:

Code: Select all

e "You should check out {a=http://www.renpy.org}renpy.org{/a} for the latest version.
Otherwise, you want to use the python webbrowser module:

Code: Select all

init python:
    def open_renpyorg():
        import webbrowser
        webbrowser.open_new('http://www.renpy.org')

...

$ ui.textbutton("Ren'Py Home Page", clicked=open_renpyorg)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4028
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: Open a URL

#3 Post by jack_norton » Wed Oct 01, 2008 11:54 am

Ahh thanks Tom :)
I've already added you in the Special Thanks section of Heileen only for that :lol:
follow me on Image Image Image Image
computer games

Chivone
Newbie
Posts: 9
Joined: Wed Sep 05, 2018 11:28 am
Contact:

Re: Open a URL

#4 Post by Chivone » Sun Oct 06, 2019 1:35 pm

And it is possible to embed the webbrowser into the screen?

User avatar
xavimat
Eileen-Class Veteran
Posts: 1433
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: Open a URL

#5 Post by xavimat » Mon Oct 07, 2019 11:50 am

Chivone wrote:
Sun Oct 06, 2019 1:35 pm
And it is possible to embed the webbrowser into the screen?
Wow, Chivone, that's asking too much to renpy.

But, renpy can access the web and retrieve information and images and use them (for example in a screen).
I do that importing urllib and urllib2.
See also: https://www.patreon.com/posts/news-from-your-15636026
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Chivone
Newbie
Posts: 9
Joined: Wed Sep 05, 2018 11:28 am
Contact:

Re: Open a URL

#6 Post by Chivone » Thu Nov 21, 2019 9:08 am

Thank you very much xavimat!

Post Reply

Who is online

Users browsing this forum: Bing [Bot]