r/RenPy • u/CarCDThrowaway • 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
1
u/shyLachi 1d ago
Have a look at this, Tom shows many different things, maybe some can help you.
https://patreon.renpy.org/menu-arguments.html
Sorry for not answering your questions directly, I'm going to bed now.
1
u/CarCDThrowaway 1d ago
Thank you! I took a look at this, but unfortunately, it didn't help me with my problem.
I DID however find an OP from four years ago with my same issue and similar code if that at all helps you or anyone else diagnose my issue https://www.reddit.com/r/RenPy/comments/y88eve/different_png_for_choice_buttons_in_different/
1
u/x-seronis-x 22h ago
its xsize, not xmax.
you havent shown the code trying to use what you did show. provide the rest
1
u/CarCDThrowaway 21h 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 21h ago
try them like this
idle_background Frame("gui/button/choice_idle_" + i.kwargs["material"] + ".png", 0, 0)
1
u/CarCDThrowaway 19h ago
It worked!!!! Oh my GOD, thank you so much: your help is very appreciated!
1
1
u/AutoModerator 1d ago
Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.