frame and vpgrid inside a vbox causes extra space?

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
sparkleface
Newbie
Posts: 9
Joined: Mon Dec 25, 2017 12:37 pm
Contact:

frame and vpgrid inside a vbox causes extra space?

#1 Post by sparkleface »

Why does the following create a huge space between the frame and the vpgrid?

Code: Select all

   vbox:
        xpos 648
        xsize 1260
        ysize 1000

        # The frame at the top
        frame:
            background Solid("#000")
            has hbox:
                xfill True
                xysize (1260, 50)
                ysize 50

            
        # the rows
        vpgrid:
            cols 1
            spacing 5
            draggable True
            mousewheel True
            scrollbars "vertical"
            side_xalign 0.5

            for i in xrange(5):
                frame:
                    background Solid("#000")
                    has hbox:
                        xfill True
                        xysize (1260, 50)
                        button:
                            xsize 150
                            text "zero"
                            ypos 5
                        button:
                            xsize 150
                            text "one"
                            ypos 5
                        button:
                            xsize 150
                            text "two"
                            ypos 5
                        button:
                            xsize 150
                            text "three"
                            ypos 5   
Basically, I'm trying to define a vbox that has a certain height, and then has a bunch of rows that can be scrollable inside the vbox. But you'll notice that in between the frame and vpgrid there is a huge space.

What is causing this extra space, and how can I get rid of it? I want the vpgrid to align right underneath the frame.
Attachments
Untitled.png

irredeemable
Regular
Posts: 78
Joined: Thu Feb 08, 2018 7:57 am
Contact:

Re: frame and vpgrid inside a vbox causes extra space?

#2 Post by irredeemable »

Looks like you're setting a fixed size for the vbox so the space will be divided evenly unless you specifiy otherwise (or the extra space is needed by one of the children). One way to get rid of it would be to set yfill True on the vpgrid, but it just depends on what exactly you're trying to do.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot]