How do you resize a viewport?

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
Georgine
Regular
Posts: 55
Joined: Fri Jan 24, 2014 7:47 am
Contact:

How do you resize a viewport?

#1 Post by Georgine »

I'm using a vbox inside a viewport as a menu, as follows:

Code: Select all

        frame:
            style_group "characternames"
            yalign 0.9
            has vbox:
                viewport:
                    mousewheel True
                    scrollbars "vertical"

                    vbox:
                        xmaximum 310
                        ymaximum 900
                        for i in range(Character_list):
                                textbutton Character_name[i]
I am trying to size the viewport to x=310 y=900 so it exactly matches the size of the child vbox, but I always get a tiny viewport only large enough to display 2 textbuttons. I've tried setting both child_size and xmaximum/ymaximum in the viewport styles, but no matter what I change it always remains the same size.

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: How do you resize a viewport?

#2 Post by Asceai »

try xminimum/yminimum as well

Georgine
Regular
Posts: 55
Joined: Fri Jan 24, 2014 7:47 am
Contact:

Re: How do you resize a viewport?

#3 Post by Georgine »

Hmm,

Code: Select all

vbox:
                        xminimum 310
                        yminimum 900
                        xmaximum 310
                        ymaximum 900
Runs, but looks identical to the version without it, and

Code: Select all

                viewport:
                    xminimum 310
                    yminimum 900

pops an error saying that xminimum and yminimum are not a valid child for viewport.

User avatar
akemicchi
Veteran
Posts: 465
Joined: Mon Dec 31, 2007 11:22 pm
Projects: Magicians of Delphine, Panaderia: Ensaimada, SweetTooth!, XOXO Droplets
Deviantart: littlebabyshoes
Contact:

Re: How do you resize a viewport?

#4 Post by akemicchi »

What about moving the xmaximum and ymaximum to the viewport? If it isn't automatically filling the space, add xfill and yfill to True. It doesn't work when I put them in vbox and only works when I put them in viewport, but maybe it'll work for you?

Code: Select all

        frame:
            style_group "characternames"
            yalign 0.9
            has vbox:
                viewport:
                    xmaximum 310
                    ymaximum 900
                    xfill True
                    yfill True
                    mousewheel True
                    scrollbars "vertical"

                    vbox:
                        for i in range(Character_list):
                                textbutton Character_name[i]

Georgine
Regular
Posts: 55
Joined: Fri Jan 24, 2014 7:47 am
Contact:

Re: How do you resize a viewport?

#5 Post by Georgine »

I can see some blue frame behind the viewport now, but the actual size remains the same as if I don't specify xfill/yfill or the maximums at all.

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: How do you resize a viewport?

#6 Post by Asceai »

Try specifying the viewport size with area (0, 0, 310, 900) instead.

Georgine
Regular
Posts: 55
Joined: Fri Jan 24, 2014 7:47 am
Contact:

Re: How do you resize a viewport?

#7 Post by Georgine »

No visible effect- it has the same configuration as with x/yfill or no specified size.

Georgine
Regular
Posts: 55
Joined: Fri Jan 24, 2014 7:47 am
Contact:

Re: How do you resize a viewport?

#8 Post by Georgine »

Oh, and in case I'm mis-using the syntax, to clarify I specified it with area() as follows:

Code: Select all

viewport:
                    area (0, 0, 310, 900)

User avatar
akemicchi
Veteran
Posts: 465
Joined: Mon Dec 31, 2007 11:22 pm
Projects: Magicians of Delphine, Panaderia: Ensaimada, SweetTooth!, XOXO Droplets
Deviantart: littlebabyshoes
Contact:

Re: How do you resize a viewport?

#9 Post by akemicchi »

I'm just guessing now since I have no idea why none of that is working, but could it maybe have something to do with the style properties you have for "characternames"? What are the properties that you have set up?

Georgine
Regular
Posts: 55
Joined: Fri Jan 24, 2014 7:47 am
Contact:

Re: How do you resize a viewport?

#10 Post by Georgine »

Hmm, that might be it- here's my styles section:

Code: Select all

        style.characternames = Style(style.frame)
        style.characternames_button.xmaximum=300
        style.characternames_button.xminimum=300
        style.characternames_button.ymaximum=20
        style.characternames_button.yminimum=20

User avatar
akemicchi
Veteran
Posts: 465
Joined: Mon Dec 31, 2007 11:22 pm
Projects: Magicians of Delphine, Panaderia: Ensaimada, SweetTooth!, XOXO Droplets
Deviantart: littlebabyshoes
Contact:

Re: How do you resize a viewport?

#11 Post by akemicchi »

Nope, it's not the style properties. That just affects the buttons. :'D

I copy-pasted the code, moved xmaximum and ymaximum to viewport, ran it, and it all seems to work just fine. I have no idea why it's not working.

Georgine
Regular
Posts: 55
Joined: Fri Jan 24, 2014 7:47 am
Contact:

Re: How do you resize a viewport?

#12 Post by Georgine »

I just figured it out, it wasn't working because I'm an idiot. XD There's another frame about 2 pages up for a completely different area, and somewhere along the line I tabbed the entire section with the frame I was having trouble with one indentation in, so the entire thing was getting the mins and maxes for a completely separate part of the interface.

Thank you so much for your patience! :)

User avatar
akemicchi
Veteran
Posts: 465
Joined: Mon Dec 31, 2007 11:22 pm
Projects: Magicians of Delphine, Panaderia: Ensaimada, SweetTooth!, XOXO Droplets
Deviantart: littlebabyshoes
Contact:

Re: How do you resize a viewport?

#13 Post by akemicchi »

Hahaha, well, I'm glad that's solved then! Good luck with your project!

Post Reply

Who is online

Users browsing this forum: No registered users