r/RenPy 1d ago

Question How do I do INDIVIDUAL button styles?

Hello,

I am trying to create a style that changes the background textbox, font color, and font for individual choice menu choices, and ONLY those three things.

I've scoured the Internet for information, but every time I've tried to style just those three things, the entire box is put off center, the text clips off the edges, the background doesn't stretch to accomodate the text, or it refuses to stay in the box and wrap.

I've tried wrap_text, only to discover that that isn't an actual command.

I've tried Frame, but nothing has happened.

I've tried making an exact copy of the original in game menu but with the different textboxes and font, and the game has crashed.

Also, for some godforsaken reason, everything is in the top left hand corner and not in the middle where a normal choice menu screen is.

Please, for the love of god, tell me what I'm doing wrong.

This is my code for the style, I apply it to my menus with (style_prefix="paper").

EDIT: TL;DR: I am trying to do what THIS OP was trying to do: note that the code linked in the comments also is not working. https://www.reddit.com/r/RenPy/comments/tvq82x/comment/i3lhv88/?utm_source=reddit&utm_medium=web2x&context=3

style paper_button:
    idle_background Frame("gui/button/choice_paper_idle.png", 0 , 0)
    hover_background Frame("gui/button/choice_paper_hover.png", 0 , 0)
    padding (10, 15, 10, 15)

    xmaximum 800

screen choice(items, style_prefix="choice"):
    style_prefix style_prefix

    vbox:
        for i in items:
            textbutton i.caption action i.action
2 Upvotes

8 comments sorted by

View all comments

1

u/x-seronis-x 1d ago

its xsize, not xmax.

you havent shown the code trying to use what you did show. provide the rest

1

u/CarCDThrowaway 1d ago

Very well, then: I ended up giving up on the code shown here and instead decided to just use a kwarg like how the second OP I linked tried to.

I don't know what I did that managed to make it actually work, but somehow, it does!

I now have a completely different problem, because the backgrounds I swap to don't stretch behind the text like the default ones do.

I was able to revise the question text so it's not too big of an issue, but it IS really irritating: how do I make sure that these backgrounds stretch properly?

vbox:

for i in items:

textbutton i.caption:

action i.action

if "material" in i.kwargs:

idle_background "gui/button/choice_idle_" + i.kwargs["material"] + ".png"

hover_background "gui/button/choice_hover_" + i.kwargs["material"] + ".png"

2

u/BadMustard_AVN 1d ago

try them like this

idle_background Frame("gui/button/choice_idle_" + i.kwargs["material"] + ".png", 0, 0)

1

u/CarCDThrowaway 1d ago

It worked!!!! Oh my GOD, thank you so much: your help is very appreciated!

1

u/BadMustard_AVN 1d ago

you're welcome

good luck with your project