Viewport vertical length very long. How to reduce?( Using images with zoom statement inside)

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
Yuvan raj
Regular
Posts: 38
Joined: Wed Feb 17, 2021 11:24 am
Contact:

Viewport vertical length very long. How to reduce?( Using images with zoom statement inside)

#1 Post by Yuvan raj »

Hello, my viewport scrolling area is too long! The Thumb is very small and it just goes down so long. I have attached a picture of my problem and the code I use. I only want to show these 7 pictures now and maximum 15 pictures later. How to make my viewport to only go down till my last element that I put inside? Thank you in advance!

Code: Select all

screen charactersbutton():
    modal True

    frame:
        background Solid("#5a5c5c")
        xpos 20 ypos 18
        xmaximum 1468
        xminimum 1468
        ymaximum 1045
        yminimum 1045
        viewport:
            scrollbars "vertical"
            mousewheel True
            draggable True
            xalign 0.5
            hbox:
                imagebutton auto "close_%s" xpos 1150 ypos 8 action [Hide("charactersbutton"), SetVariable("characters_imagebutton_list_boolean",True)]:
                    at transform:
                        zoom 0.2
Image
Last edited by Yuvan raj on Sun May 23, 2021 12:41 pm, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Viewport vertical scrolling area very long.

#2 Post by Alex »

This is the code for close-button, and wat about all other images inside a viewport?

Also, try to play with the size of the frame

Code: Select all

    frame:
        background Solid("#5a5c5c")
        xpos 20 ypos 18
        xmaximum 1468
        xminimum 1468
        ymaximum 1045
        yminimum 1045
(check the part with 'area' in sample code - https://www.renpy.org/doc/html/screens.html#viewport)

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Viewport vertical scrolling area very long.

#3 Post by Remix »

You have not shown the part of the code that has the images... It is likely that those are what is making the viewport content so large.
Frameworks & Scriptlets:

Yuvan raj
Regular
Posts: 38
Joined: Wed Feb 17, 2021 11:24 am
Contact:

Re: Viewport vertical scrolling area very long.

#4 Post by Yuvan raj »

Alex wrote: Sun May 23, 2021 5:20 am This is the code for close-button, and wat about all other images inside a viewport?

Also, try to play with the size of the frame

Code: Select all

    frame:
        background Solid("#5a5c5c")
        xpos 20 ypos 18
        xmaximum 1468
        xminimum 1468
        ymaximum 1045
        yminimum 1045
(check the part with 'area' in sample code - https://www.renpy.org/doc/html/screens.html#viewport)
Remix wrote: Sun May 23, 2021 5:37 am You have not shown the part of the code that has the images... It is likely that those are what is making the viewport content so large.

This is my code, and yes now that you guys mention it. The images are VERY big. I'll probably reduce its original size and format when I release the game but for now I used the transform 'zoom' statement to reduce it's size. Below this code is the size of the original picture without zoom statement.

Code: Select all

    vbox:
            spacing 30
            xalign 0.5
            hbox:
                spacing 30

                imagebutton idle "images/status_images/characters/1 character.png" action [SetVariable("characters_imagebutton_list_boolean", False), SetVariable("first_character_imagebutton", True), Hide("charactersbuttonlist")]

                imagebutton idle "images/status_images/characters/2 character.png" action NullAction():
                    at transform:
                        zoom 0.30

                imagebutton idle "images/status_images/characters/3 character.png" action NullAction():
                    at transform:
                        zoom 0.30

            hbox:
                spacing 30
                imagebutton idle "images/status_images/characters/4 character.png" action NullAction():
                    at transform:
                        zoom 0.30

                imagebutton idle "images/status_images/characters/5 character.png" action NullAction():
                    at transform:
                        zoom 0.30

                imagebutton idle "images/status_images/characters/6 character.png" action NullAction():
                    at transform:
                        zoom 0.30

And this is the original size of pics used
Image

Is there a way to reduce the scrollbar vertical area without decreasing the images used in viewport's size? Is there no other way to reduce the viewport size other than resizing the images?

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Viewport vertical scrolling area very long.

#5 Post by Alex »

Try to declare all images, like

Code: Select all

image button_1_idle:
    "images/status_images/characters/1 character.png"
    zoom 0.35
and use those images for imagebuttons

Code: Select all

imagebutton idle 'button_1_idle':

Yuvan raj
Regular
Posts: 38
Joined: Wed Feb 17, 2021 11:24 am
Contact:

Re: Viewport vertical scrolling area very long.

#6 Post by Yuvan raj »

Alex wrote: Sun May 23, 2021 6:44 am Try to declare all images, like

Code: Select all

image button_1_idle:
    "images/status_images/characters/1 character.png"
    zoom 0.35
and use those images for imagebuttons

Code: Select all

imagebutton idle 'button_1_idle':
Declared all the images event the close button but still getting the same results. :(

Code: Select all

image close_idle:
    "images/guichange/close_idle.png"
    zoom 0.2
image close_hover:
    "images/guichange/close_hover.png"
    zoom 0.2

image backfont_idle:
    "images/guichange/backfont_idle.png"
    zoom 0.18
image backfont_hover:
    "images/guichange/backfont_hover.png"
    zoom 0.18
    
image 1_character:
    "images/status_images/characters/1 character.png"
    zoom 0.3
image 2_character:
    "images/status_images/characters/2 character.png"
    zoom 0.3
image 3_character:
    "images/status_images/characters/3 character.png"
    zoom 0.3
image 4_character:
    "images/status_images/characters/4 character.png"
    zoom 0.3
image 5_character:
    "images/status_images/characters/5 character.png"
    zoom 0.3
image 6_character:
    "images/status_images/characters/6 character.png"
    zoom 0.3
image 7_character:
    "images/status_images/characters/7 character.png"
    zoom 0.3
    
screen charactersbuttonlist():
    vbox:
        ypos 130
        xmaximum 1468
        xminimum 1468
        spacing 30
        xalign 0.5

        vbox:
            spacing 30
            xalign 0.5
            hbox:
                spacing 30

                imagebutton idle "1_character" action [SetVariable("characters_imagebutton_list_boolean", False), SetVariable("romi_character_imagebutton", True), Hide("charactersbuttonlist")]

                imagebutton idle "2_character" action NullAction()

                imagebutton idle "3_character" action NullAction()


            hbox:
                spacing 30
                imagebutton idle "4_character" action NullAction()

                imagebutton idle "5_character" action NullAction()

                imagebutton idle "6_character" action NullAction()

            hbox:
                spacing 30
                imagebutton idle "7_character" action NullAction()
 

Still getting the same result.

Image

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Viewport vertical length very long. How to reduce?( Using images with zoom statement inside)

#7 Post by Alex »

Could you provide a test project with some images and code for the screen to let people check it?

Post Reply

Who is online

Users browsing this forum: No registered users