How can I make a "Show CG"/"Hide UI" button?
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.
How can I make a "Show CG"/"Hide UI" button?
Something I'm used to from playing games based on other visual novel engines is the ability for the user to temporarily hide all of the game's user interface and just show the artwork in the background.
Usually this is either handled by right-clicking anywhere in the game window, or by clicking a button somewhere on the screen. Everything disappears except the painting/pretty girl/whatever in the background, until the user clicks the mouse or hits a key.
I think what I mean in Ren'Py terms is that I'd like to let the user do a 'window hide' any time they want. Is there a way to do that?
(I'd especially love to get the right mouse button doing that, but I'm not sure if it's possible.)
Thanks for any help!
Usually this is either handled by right-clicking anywhere in the game window, or by clicking a button somewhere on the screen. Everything disappears except the painting/pretty girl/whatever in the background, until the user clicks the mouse or hits a key.
I think what I mean in Ren'Py terms is that I'd like to let the user do a 'window hide' any time they want. Is there a way to do that?
(I'd especially love to get the right mouse button doing that, but I'm not sure if it's possible.)
Thanks for any help!
- Aleema
- Lemma-Class Veteran
- Posts: 2677
- Joined: Fri May 23, 2008 2:11 pm
- Organization: happyB
- Tumblr: happybackwards
- Contact:
Re: How can I make a "Show CG"/"Hide UI" button?
The middle mouse button does this (also, the key "H"). Did you know that, or do you still want to reassign the keymap?
Re: How can I make a "Show CG"/"Hide UI" button?
Ah, thank you! I was searching for the way to do it, but couldn't seem to find a thread/FAQ entry where it was mentioned. (Edit: Figures it was under the Help button.) I'm using one of those weird Apple mice without any buttons (let alone a middle one), so it didn't occur to me that it might have been that.
That should work fine, yes! However, from a tinkerer's point of view, I'm still curious how one would go about changing the keymap or creating an interface button for it. If you know how to do so, I'd be grateful for the explanation.
That should work fine, yes! However, from a tinkerer's point of view, I'm still curious how one would go about changing the keymap or creating an interface button for it. If you know how to do so, I'd be grateful for the explanation.
- Aleema
- Lemma-Class Veteran
- Posts: 2677
- Joined: Fri May 23, 2008 2:11 pm
- Organization: happyB
- Tumblr: happybackwards
- Contact:
Re: How can I make a "Show CG"/"Hide UI" button?
An interface button for it would look something like:
To change a keymap, look over all the current definitions. You'll see the hiding the windows is assigned to the following three buttons: 'mouseup_2', 'h', 'joy_hide'
The button value for "right mouse click" is 'mouseup_3'. So you'd probably want something like this:
Code: Select all
ui.imagebutton("hidebuttonoff.png", "hidebuttonon.png", clicked=renpy.curried_call_in_new_context("_hide_windows"))The button value for "right mouse click" is 'mouseup_3'. So you'd probably want something like this:
Code: Select all
init:
$ config.keymap['hide_windows'].append('mouseup_3')
$ config.keymap['hide_windows'].remove('mouseup_2')Re: How can I make a "Show CG"/"Hide UI" button?
Wow, thank you for the help. It's amazing to me how powerful Ren'Py can be when one knows how to use it.
This also answers about a dozen questions I had about how to set up a custom interface, since it lead me to reading up on the various "ui" functions. So, again, thanks!
Looking over the various projects linked in your sig, now I'm wondering if there's anything Ren'Py can't do.
This also answers about a dozen questions I had about how to set up a custom interface, since it lead me to reading up on the various "ui" functions. So, again, thanks!
Looking over the various projects linked in your sig, now I'm wondering if there's anything Ren'Py can't do.
- Aleema
- Lemma-Class Veteran
- Posts: 2677
- Joined: Fri May 23, 2008 2:11 pm
- Organization: happyB
- Tumblr: happybackwards
- Contact:
Re: How can I make a "Show CG"/"Hide UI" button?
Good for you! UI functions are really, really awesome.Mizuiru wrote:Wow, thank you for the help. It's amazing to me how powerful Ren'Py can be when one knows how to use it.
This also answers about a dozen questions I had about how to set up a custom interface, since it lead me to reading up on the various "ui" functions. So, again, thanks!
Looking over the various projects linked in your sig, now I'm wondering if there's anything Ren'Py can't do.
And yes, if you know a little Python, Ren'Py can go a looong way.
- boboverlord
- Newbie
- Posts: 19
- Joined: Thu Nov 27, 2008 11:01 am
- Contact:
Re: How can I make a "Show CG"/"Hide UI" button?
I'm finding this answer too! Great help!
- Soraminako
- Veteran
- Posts: 277
- Joined: Sun Sep 04, 2011 1:36 am
- Projects: A thingie without a title. With messy code.
- Contact:
Re: How can I make a "Show CG"/"Hide UI" button?
Sorry to resurrect an old thread, but I was trying to do something similar to what this code would do, and was wondering if I might be missing something to make it work...Aleema wrote:An interface button for it would look something like:Code: Select all
ui.imagebutton("hidebuttonoff.png", "hidebuttonon.png", clicked=renpy.curried_call_in_new_context("_hide_windows"))
I tried:
Code: Select all
ui.imagebutton("hidebuttonoff.png", "hidebuttonon.png", clicked=renpy.curried_call_in_new_context("_screenshot"))I was trying to make a button that does what the "s" key does, saving a screenshot for the player.
Also, is there a way to change the place to where the screenshots are saved? ^^;
I've been scouring the old posts but couldn't find anything on that.
(I drew my avatar especially to express the scary feeling I get from the code as I type it... XD)
- DragoonHP
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
- Contact:
Re: How can I make a "Show CG"/"Hide UI" button?
It should probably work...
Code: Select all
textbutton _("Screenshot") action Screenshot()- Soraminako
- Veteran
- Posts: 277
- Joined: Sun Sep 04, 2011 1:36 am
- Projects: A thingie without a title. With messy code.
- Contact:
Re: How can I make a "Show CG"/"Hide UI" button?
It crashes ren'py, but this seems to be due to the same bug in reaction to bracket folders that ren'py was having before the upgrade to 6.13.7. It's odd. O_o
(I drew my avatar especially to express the scary feeling I get from the code as I type it... XD)
- DragoonHP
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
- Contact:
Re: How can I make a "Show CG"/"Hide UI" button?
It works on my 6.13.7...
Weird...
Try to place it in Quick Menu and see if it works...
Weird...
Try to place it in Quick Menu and see if it works...
- Soraminako
- Veteran
- Posts: 277
- Joined: Sun Sep 04, 2011 1:36 am
- Projects: A thingie without a title. With messy code.
- Contact:
Re: How can I make a "Show CG"/"Hide UI" button?
That game is a short one for which I disabled quick menu, but in any case, PyTom confirmed the problem comes from ren'py reacting to the brackets in the title of folders and crashing. So once that's fixed the code should work for me too. 
(I drew my avatar especially to express the scary feeling I get from the code as I type it... XD)
- Purukitto
- Newbie
- Posts: 2
- Joined: Mon Aug 16, 2021 1:02 pm
- Github: Purukitto
- itch: purukitto
- Contact:
Re: How can I make a "Show CG"/"Hide UI" button?
The simplest way in the latest version would be to do the following
Code: Select all
textbutton _('Hide UI') action HideInterface()Who is online
Users browsing this forum: No registered users


