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.
-
oatnoodles
- Regular
- Posts: 47
- Joined: Tue Aug 03, 2021 6:26 pm
- Projects: Samuda Interval
- Organization: Tomuwa Entertainment
- Deviantart: oatnoodles
- Github: oatnoodles
- itch: oatnoodles
- Discord: oatnoodles#0099
-
Contact:
#1
Post
by oatnoodles » Wed Feb 16, 2022 3:08 pm
I feel like I'm going a little grazy lol. I'm trying to change the position of my choice menu frame, not just the buttons, but the entire box. I want to use a frame for the background of the menu itself so it can fit to the size/amount of choice options. However whatever I try I can't get to background to move, it just sits in the top left corner. The buttons move fine.
Here's my current code:
Code: Select all
screen choice(items):
style_prefix "choice"
frame:
background "gui/frame-dark.png"
at WindowEaseBottom
vbox:
for i in items:
textbutton i.caption action i.action
## When this is true, menu captions will be spoken by the narrator. When false,
## menu captions will be displayed as empty buttons.
define config.narrator_menu = True
style choice_vbox is vbox
style choice_button is button
style choice_button_text is button_text
style choice_vbox:
style choice_button is default:
properties gui.button_properties("choice_button")
background Frame("gui/choice-idle.png")
idle_background Frame("gui/choice-idle.png")
hover_background Frame("gui/frame.png")
style choice_button_text is default:
properties gui.button_text_properties("choice_button")
Last edited by
oatnoodles on Sat Feb 19, 2022 3:40 pm, edited 2 times in total.
Ren'py amateur looking to learn as much as possible! Please be patient with me.
-
Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#2
Post
by Ocelot » Wed Feb 16, 2022 4:57 pm
You have a frame without children. In this case a fixed is created to be its child. Fixed expands to fill all avaliable area. So you have frame which fills whole window. and as background image wasn't positioned explicitely, it uses default position in top-right corner of the frame.
You probaly want to indent vbox, so it would become the single child of the frame.
< < insert Rick Cook quote here > >
-
oatnoodles
- Regular
- Posts: 47
- Joined: Tue Aug 03, 2021 6:26 pm
- Projects: Samuda Interval
- Organization: Tomuwa Entertainment
- Deviantart: oatnoodles
- Github: oatnoodles
- itch: oatnoodles
- Discord: oatnoodles#0099
-
Contact:
#3
Post
by oatnoodles » Wed Feb 16, 2022 8:01 pm
Ocelot wrote: ↑Wed Feb 16, 2022 4:57 pm
You have a frame without children. In this case a fixed is created to be its child. Fixed expands to fill all avaliable area. So you have frame which fills whole window. and as background image wasn't positioned explicitely, it uses default position in top-right corner of the frame.
You probaly want to indent vbox, so it would become the single child of the frame.
Thank you, that worked perfectly.
Is it possible to make the frame a certain width and height? I tried xmaximum/ymaximum but it just moved the box over. Also, is there a way to fit the background to the amount of choices? Currently it does move up to show there's another option (going from 3 choices to 4) but the frame itself is the same size.
Ren'py amateur looking to learn as much as possible! Please be patient with me.
-
Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#4
Post
by Ocelot » Thu Feb 17, 2022 3:53 am
oatnoodles wrote: ↑Wed Feb 16, 2022 8:01 pm
I tried xmaximum/ymaximum but it just moved the box over.
First of all: x/y maximum relates to maximum size displayable is allowed to have, if it is smaller than that, it won't do anything. Second, by default all elements are placed in top-left corner of their parent, if nothing overrides their placement.
It is possible to increase frame size, but what do you exactly want? Exact size? At least X wide/tall? Y wider/taller than containing choices?
oatnoodles wrote: ↑Wed Feb 16, 2022 8:01 pm
Also, is there a way to fit the background to the amount of choices? Currently it does move up to show there's another option (going from 3 choices to 4) but the frame itself is the same size.
If you want background to scale, you need to provide displayable, which can scale itself. Usually
Frame is used. Do not mix up with
frame, those are different things.
https://www.renpy.org/doc/html/displayables.html#Frame
< < insert Rick Cook quote here > >
-
oatnoodles
- Regular
- Posts: 47
- Joined: Tue Aug 03, 2021 6:26 pm
- Projects: Samuda Interval
- Organization: Tomuwa Entertainment
- Deviantart: oatnoodles
- Github: oatnoodles
- itch: oatnoodles
- Discord: oatnoodles#0099
-
Contact:
#5
Post
by oatnoodles » Thu Feb 17, 2022 1:56 pm
Ocelot wrote: ↑Thu Feb 17, 2022 3:53 am
oatnoodles wrote: ↑Wed Feb 16, 2022 8:01 pm
I tried xmaximum/ymaximum but it just moved the box over.
First of all: x/y maximum relates to maximum size displayable is allowed to have, if it is smaller than that, it won't do anything. Second, by default all elements are placed in top-left corner of their parent, if nothing overrides their placement.
It is possible to increase frame size, but what do you exactly want? Exact size? At least X wide/tall? Y wider/taller than containing choices?
oatnoodles wrote: ↑Wed Feb 16, 2022 8:01 pm
Also, is there a way to fit the background to the amount of choices? Currently it does move up to show there's another option (going from 3 choices to 4) but the frame itself is the same size.
If you want background to scale, you need to provide displayable, which can scale itself. Usually
Frame is used. Do not mix up with
frame, those are different things.
https://www.renpy.org/doc/html/displayables.html#Frame
I want a minimum/maximum size (not sure exactly what yet, let's say 600 x 200 for example) and the frame will become smaller and/or bigger depending on how many choices there are currentlyu displaying. How would I implement the Frame displayable + the sizing into my code?
Ren'py amateur looking to learn as much as possible! Please be patient with me.
-
Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#6
Post
by Ocelot » Thu Feb 17, 2022 3:17 pm
Code: Select all
screen choice(items):
style_prefix "choice"
frame:
at WindowEaseBottom # don't know what it contains, so I will keep it here and not move to the style definition
has vbox # equvalent to "vbox:" but without needing aniother indentation level
for i in items:
textbutton i.caption action i.action
style choice_frame is frame: # I prefer to keep most style propertie in styles
background Frame("gui/frame-dark.png") # This will just stretch image without using borders
minimum (300, 400) # (x, y)
maximum (900, 700) # if content will exceed maximum size, it will be cut off
padding (10, 10) # This will add 10 pixels padding between edges of the background and content
< < insert Rick Cook quote here > >
-
oatnoodles
- Regular
- Posts: 47
- Joined: Tue Aug 03, 2021 6:26 pm
- Projects: Samuda Interval
- Organization: Tomuwa Entertainment
- Deviantart: oatnoodles
- Github: oatnoodles
- itch: oatnoodles
- Discord: oatnoodles#0099
-
Contact:
#7
Post
by oatnoodles » Sat Feb 19, 2022 3:40 pm
Ocelot wrote: ↑Thu Feb 17, 2022 3:17 pm
Code: Select all
screen choice(items):
style_prefix "choice"
frame:
at WindowEaseBottom # don't know what it contains, so I will keep it here and not move to the style definition
has vbox # equvalent to "vbox:" but without needing aniother indentation level
for i in items:
textbutton i.caption action i.action
style choice_frame is frame: # I prefer to keep most style propertie in styles
background Frame("gui/frame-dark.png") # This will just stretch image without using borders
minimum (300, 400) # (x, y)
maximum (900, 700) # if content will exceed maximum size, it will be cut off
padding (10, 10) # This will add 10 pixels padding between edges of the background and content
Awesome, I got it to work! TYSM ^^
Ren'py amateur looking to learn as much as possible! Please be patient with me.
Users browsing this forum: No registered users