Hi,
I'm making a small VN, and I had a few people asking me if I can make it so that they can copy the text while playing the game and then paste it in Google Translate or something. Is that possible? Like a adding a button that copies the current text and adds it to the clipboard.
I think it will be a very useful function for everyone who's English is not good enough.
Thanks.
Copying the ingame text to the clipboard?
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.
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.
- IrinaLazareva
- Veteran
- Posts: 399
- Joined: Wed Jun 08, 2016 1:49 pm
- Projects: Legacy
- Organization: SunShI
- Location: St.Petersburg, Russia
- Contact:
Re: Copying the ingame text to the clipboard?
somewhere in the script:
and then just add to the say() screen:
https://www.pygame.org/docs/ref/scrap.h ... .scrap.put
Code: Select all
init python:
import pygame.scrap
def scrubs(what):
pygame.scrap.put(pygame.SCRAP_TEXT, what.encode("utf-8"))
renpy.notify("The text is now on the clipboard.")
Code: Select all
screen say(who, what):
###<body of the screen>
if what:
textbutton _('Copy into the clipboard') style 'quick_button' action Function(scrubs, what) at right
Re: Copying the ingame text to the clipboard?
Thank you, works like a charm. Much appreciated.
Who is online
Users browsing this forum: Google [Bot]