Can Ren'Py make a button that will print the window/screen ?

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
megan328
Newbie
Posts: 4
Joined: Wed Feb 05, 2014 7:56 am
Contact:

Can Ren'Py make a button that will print the window/screen ?

#1 Post by megan328 »

I am just getting started with Ren'Py and before I get too far, I need to know if it is possible to make a button that when clicked will bring up the print dialog and allow the user to print the contents of the game window ?? e.g. what's on the game screen

Thanks! Megan

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: Can Ren'Py make a button that will print the window/scre

#2 Post by PyTom »

This isn't possible in Ren'Py.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

megan328
Newbie
Posts: 4
Joined: Wed Feb 05, 2014 7:56 am
Contact:

Re: Can Ren'Py make a button that will print the window/scre

#3 Post by megan328 »

*Sigh* OK, Thanks

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Can Ren'Py make a button that will print the window/scre

#4 Post by Asceai »

I have a suggestion, although it's not perfect and I haven't really looked into writing files in ren'py and ensuring stuff gets into the correct place, but:

1) Ren'Py can take screenshots (renpy.screenshot())
2) Ren'Py can write arbitrary files (Python file support)
3) Ren'Py can open a web browser to a file on disk (Help(), although this is a screen action, those are easy enough to force)
4) JavaScript can be used to open a print dialog (window.print())

So, take a screenshot, write out a HTML file including that screenshot and some Javascript that opens the print dialog and then have a screen open that HTML file in a web browser. With any luck Firefox or Chrome or whatever will pop open and the print dialogue will come up.

megan328
Newbie
Posts: 4
Joined: Wed Feb 05, 2014 7:56 am
Contact:

Re: Can Ren'Py make a button that will print the window/scre

#5 Post by megan328 »

Awesome Suggestion! Thanks so much for thinking of this and posting the reply - I will try it :-) ~Megan

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: Can Ren'Py make a button that will print the window/scre

#6 Post by PyTom »

Asceai wrote:3) Ren'Py can open a web browser to a file on disk (Help(), although this is a screen action, those are easy enough to force)
You can also just use the webbrowser module directly.

Code: Select all

init python:
    import webbrowser

webbrowser.open('http://www.google.com')
What's the use case, anyway?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

megan328
Newbie
Posts: 4
Joined: Wed Feb 05, 2014 7:56 am
Contact:

Re: Can Ren'Py make a button that will print the window/scre

#7 Post by megan328 »

Thanks! You guys are just SO helpful here -> use case: I am wanting to make some learning activities and wanted to have some accompanying "printables" for use outside the program - that is the idea anyway - been looking at different options and Ren'Py looks like a good possibility for accomplishing what I have in mind :-)

thank you again, Megan

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

Re: Can Ren'Py make a button that will print the window/screen ?

#8 Post by Chivone »

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

Post Reply

Who is online

Users browsing this forum: No registered users