Highlighted background on choice buttons[SOLVED]

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
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Highlighted background on choice buttons[SOLVED]

#1 Post by TellerFarsight »

By default, the choice menu buttons keep the text colour the same but have a background bar that is black on idle and a different colour on hover.
I'm making a custom screen. How do I have this changing background rather than having the text itself change colour?
Last edited by TellerFarsight on Wed Jun 21, 2017 11:26 am, edited 1 time in total.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Highlighted background on choice buttons

#2 Post by DannyGMaster »

I assume you want to make a completely new screen that behaves this way? You could set it up with auto imagebuttons.

Code: Select all

screen my_screen():
     vbox xalign .5 yalign .5:
          imagebutton auto "gui/my_button_%s.png" action MyAction()

In your gui folder, you need to add a set of buttons with that name but where %s in the code is you put the state you want that button to show with. Each should be the same button but with a different design, or color.

my_button_idle.png
my_button_hover.png
my_button_selected_idle.png
my_button_selected_hover.png

And so on. Here's a complete list https://www.renpy.org/doc/html/screens. ... magebutton

If unsure, see in the gui folder, the default choice buttons should be there and they are a fine example.
The silent voice within one's heart whispers the most profound wisdom.

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Highlighted background on choice buttons

#3 Post by TellerFarsight »

So I just need to make that background bar a .png file? Is there no way to have it purely with code and hex color codes?
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Highlighted background on choice buttons

#4 Post by DannyGMaster »

Well, I suggested imagebuttons because I think it's the easiest way to do it. I know you can generate images
with pygame using pure code, and Ren'py can use pygame code, but I don't know if that code can be used for
screens in place of image files, in theory it should be possible but you would probably need a lot of code. Don't know if this will be useful but check here https://www.renpy.org/doc/html/udd.html and https://www.renpy.org/doc/html/displayables.html
The silent voice within one's heart whispers the most profound wisdom.

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Highlighted background on choice buttons

#5 Post by TellerFarsight »

Alright, so I used inspection on one of the default choice buttons and

Code: Select all

style choice_button:
    background <Frame at 779ba50>
    padding (100, 5, 100, 5)
    xsize 790
Is this background frame the thing I'm talking about? Can I use this for custom buttons?
It doesn't look like it's done with imagebuttons, so I'm just wondering how this is done by default Ren'Py
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Highlighted background on choice buttons

#6 Post by TellerFarsight »

Wait no never mind I found it. It is a .png file.
Thanks for the help!
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

Post Reply

Who is online

Users browsing this forum: Alex, Andredron, Bing [Bot], geoWaffle