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.
I'm having some difficulty with my choice screen right now (see thread: viewtopic.php?f=8&t=56835#top ), but something else I'd like to do is change the size of the box around the buttons, depending on how many choices there are.
It's my first time using frames so I don't really know what I'm doing, but here's my setup:
screen choice(items):
style_prefix "choice"
vbox:
add Frame("gui/menu_frame.png", 44, 44) xalign 0.5 yalign 0.4
for i in items:
if " (grey)" in i.caption:
button:
action i.action
style "menu_choice_grey_button"
text i.caption.replace(" (grey)", "") style "menu_choice_grey_text"
else:
button:
xysize (575, 80)
action i.action
text i.caption xalign 0.5 yalign 0.5#style "menu_choice_text"
I tried "add Frame" in various locations but it just fills the screen and pushes everything else down. I originally had "add "menubox" which was a fixed size backdrop, and whilst it worked, it looked silly with only 2 choices and overspilled with 5+.
Any ideas?
Last edited by Kinmoku on Thu Sep 12, 2019 8:44 am, edited 1 time in total.
I'm having some difficulty with my choice screen right now (see thread: viewtopic.php?f=8&t=56835#top ), but something else I'd like to do is change the size of the box around the buttons, depending on how many choices there are.
It's my first time using frames so I don't really know what I'm doing, but here's my setup:
screen choice(items):
style_prefix "choice"
vbox:
add Frame("gui/menu_frame.png", 44, 44) xalign 0.5 yalign 0.4
for i in items:
if " (grey)" in i.caption:
button:
action i.action
style "menu_choice_grey_button"
text i.caption.replace(" (grey)", "") style "menu_choice_grey_text"
else:
button:
xysize (575, 80)
action i.action
text i.caption xalign 0.5 yalign 0.5#style "menu_choice_text"
I tried "add Frame" in various locations but it just fills the screen and pushes everything else down. I originally had "add "menubox" which was a fixed size backdrop, and whilst it worked, it looked silly with only 2 choices and overspilled with 5+.
Any ideas?
Move the frame as a sibling of the container vbox and not as a child of that container...
screen choice(items):
style_prefix "choice"
add Frame("gui/menu_frame.png", 44, 44) xalign 0.5 yalign 0.4 ## This should not be a child of the vbox, doing so will fill the screen and stack below the choices
vbox:
for i in items:
if " (grey)" in i.caption:
button:
action i.action
style "menu_choice_grey_button"
text i.caption.replace(" (grey)", "") style "menu_choice_grey_text"
else:
button:
xysize (575, 80)
action i.action
text i.caption xalign 0.5 yalign 0.5#style "menu_choice_text"