A button that alternately shows and hides a screen
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.
- DesertFox
- Regular
- Posts: 196
- Joined: Sun Jul 28, 2013 1:29 pm
- Completed: Over The Hills And Far Away
- Projects: My Little Dictator
- Organization: WarGirl Games
- Contact:
A button that alternately shows and hides a screen
I'm trying to implement a button that when clicked once will show the quickmenu, and then when clicked again, will hide it.
What line of coding would I need for an imagebutton that hides and then shows another screen?
What line of coding would I need for an imagebutton that hides and then shows another screen?
- SundownKid
- Lemma-Class Veteran
- Posts: 2299
- Joined: Mon Feb 06, 2012 9:50 pm
- Completed: Icebound, Selenon Rising Ep. 1-2
- Projects: Selenon Rising Ep. 3-4
- Organization: Fastermind Games
- Deviantart: sundownkid
- Location: NYC
- Contact:
Re: A button that alternately shows and hides a screen
You have to make it 2 buttons inside a screen with a conditional branch. One press of the button sets the variable like "button1hide" to "True" and another press sets it to false. The first button shows the screen and the 2nd hides it.
- Asceai
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: A button that alternately shows and hides a screen
It doesn't have to be 2 buttons, and you don't necessarily need a separate variable:
action If(renpy.get_screen("myscreen"), Hide("myscreen"), Show("myscreen"))
Of course, if you do want to use a separate variable, I'd recommend using ToggleVariable so you don't need the conditional.
action If(renpy.get_screen("myscreen"), Hide("myscreen"), Show("myscreen"))
Of course, if you do want to use a separate variable, I'd recommend using ToggleVariable so you don't need the conditional.
- DesertFox
- Regular
- Posts: 196
- Joined: Sun Jul 28, 2013 1:29 pm
- Completed: Over The Hills And Far Away
- Projects: My Little Dictator
- Organization: WarGirl Games
- Contact:
Re: A button that alternately shows and hides a screen
Thank you, that works perfectly
Quick question - any way to apply a transition to the show and hide actions here?
Quick question - any way to apply a transition to the show and hide actions here?
Who is online
Users browsing this forum: Google [Bot], zyric


