Can I rescale the background image of a frame dynamically?

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
Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Can I rescale the background image of a frame dynamically?

#1 Post by Ryue »

I've got the following in one of my codes

Code: Select all

            
    frame:
        xalign 0.5
        yalign 0.5
        background "Graphics/GUI/choicebox.png"
The frame itself can have a specific height needed when the screen it is in is called, or a specific different height.
My question is: Is it possible to tell the background to be of a specific height? (thus scale it inside the screen)?

User avatar
NialGrenville
Regular
Posts: 184
Joined: Tue Aug 30, 2016 6:30 pm
Projects: PaS: The Awakening; The Heart Woods; The Witch and the Fairy
Organization: Gabe Works, Inc.
Contact:

Re: Can I rescale the background image of a frame dynamicall

#2 Post by NialGrenville »

I believe you can use x/y size. depending on which direction you want it to grow/shrink.

While I've never used it on a bg image, I've used it on my text/narration boxes.

Here:https://www.renpy.org/doc/html/screens. ... properties

I'll see if I can find a thread on it too.
*Me*, *You, ***Calamazoo: *Singularity-A.I.*: *Proceed to processing
PaS: The Awakening, current status: 42%
The HeartWoods, current status: 0%
The Wonderful Mell! My PFI creator Honest Critique

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Can I rescale the background image of a frame dynamicall

#3 Post by Ryue »

NialGrenville wrote:I believe you can use x/y size. depending on which direction you want it to grow/shrink.

While I've never used it on a bg image, I've used it on my text/narration boxes.

Here:https://www.renpy.org/doc/html/screens. ... properties

I'll see if I can find a thread on it too.
If I use xsize, ysize or xysize directly on the background it gets used on the frame instead.....cutting it off in the end.

User avatar
NialGrenville
Regular
Posts: 184
Joined: Tue Aug 30, 2016 6:30 pm
Projects: PaS: The Awakening; The Heart Woods; The Witch and the Fairy
Organization: Gabe Works, Inc.
Contact:

Re: Can I rescale the background image of a frame dynamicall

#4 Post by NialGrenville »

If that's the case, don't use a frame. Use scene and adjust the photo via image editor. I've never dealt with issues like this. I'd definitely never consider putting a background in a frame. Maybe that's just me, but I have no clue.
*Me*, *You, ***Calamazoo: *Singularity-A.I.*: *Proceed to processing
PaS: The Awakening, current status: 42%
The HeartWoods, current status: 0%
The Wonderful Mell! My PFI creator Honest Critique

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Can I rescale the background image of a frame dynamicall

#5 Post by Ryue »

NialGrenville wrote:If that's the case, don't use a frame. Use scene and adjust the photo via image editor. I've never dealt with issues like this. I'd definitely never consider putting a background in a frame. Maybe that's just me, but I have no clue.
Not sure how I can do it differently.
But lets see I'll put up the complete code and an exmple of how it looks currenlty:

Code: Select all

screen ChoiceLarge(title, choice1, choice2, choice3 = None, choice4 = None, choicesHiddenByDefault = True):
    default choiceToolTip = Tooltip("")
    default choice1Text = Tooltip(" \n \n ")
    default choice2Text = Tooltip(" \n \n ")
    default choice3Text = Tooltip(" \n \n ")
    default choice4Text = Tooltip(" \n \n ")

    if (choice4 <> None and choice3 == None):
        $choice3 = choice4
        $choice4 = None
    
    if (choicesHiddenByDefault == False):
        $choice1Text = Tooltip(choice1._ChoiceText)
        $choice2Text = Tooltip(choice2._ChoiceText)
        
        if (choice3 <> None):
            $choice3Text = Tooltip(choice3._ChoiceText)
            
        if (choice4 <> None):
            $choice4Text = Tooltip(choice4._ChoiceText)
    frame:
        xalign 0.5
        yalign 0.5
        background "Graphics/GUI/choicebox.png"
        
        frame:
            #background "#333333"
            background None

            vbox:
                text title size 24 xalign 0.5 color "#FEEEEE"
                text "" size 8
                
                vbox:
                    xalign 0.5
                    
                    hbox:
                        xsize 1300

                        frame:
                            background choice1._ChoiceImage
                            xysize 64, 64
                            xalign 0
                            yalign 0.5

                            imagebutton:
                                idle "Graphics/GUI/choiceboxoptions.png"
                                hover "Graphics/GUI/options_hover.png"
                                selected_idle "Graphics/GUI/options_hover.png"
                                selected_hover "Graphics/GUI/options_hover.png"
                                hovered [choiceToolTip.Action(choice1._ToolTip), choice1Text.Action(choice1._ChoiceText)]
                                action Return(ChoicesDTO("", "", "", "Choose1", choice1._ChoiceText))
                        frame:
                            background None
                            yalign 0.5
                            ysize 115
                            xsize 1200
                            #text choice1Text.value yalign 0.5
                            text choice1._ChoiceText yalign 0.5
                            
                    hbox:
                        xsize 1300

                        frame:
                            background choice2._ChoiceImage
                            xysize 64, 64
                            xalign 0
                            yalign 0.5

                            imagebutton:
                                idle "Graphics/GUI/choiceboxoptions.png"
                                hover "Graphics/GUI/options_hover.png"
                                selected_idle "Graphics/GUI/options_hover.png"
                                selected_hover "Graphics/GUI/options_hover.png"
                                hovered [choiceToolTip.Action(choice2._ToolTip), choice2Text.Action(choice2._ChoiceText)]
                                action Return(ChoicesDTO("", "", "", "Choose2", choice2._ChoiceText))
                        frame:
                            background None
                            yalign 0.5
                            xsize 1200
                            ysize 115
                            #text choice2Text.value yalign 0.5
                            text choice2._ChoiceText yalign 0.5
                            
                    if (choice3 <> None):
                         hbox:
                            xsize 1300
                            yalign 0.5

                            frame:
                                background choice3._ChoiceImage
                                xysize 64, 64
                                xalign 0

                                imagebutton:
                                    idle "Graphics/GUI/choiceboxoptions.png"
                                    hover "Graphics/GUI/options_hover.png"
                                    selected_idle "Graphics/GUI/options_hover.png"
                                    selected_hover "Graphics/GUI/options_hover.png"
                                    hovered [choiceToolTip.Action(choice3._ToolTip), choice3Text.Action(choice3._ChoiceText)]
                                    action Return(ChoicesDTO("", "", "", "Choose3", choice3._ChoiceText))
                            frame:
                                background None
                                yalign 0.5
                                xsize 1200
                                ysize 115
                                #text choice3Text.value yalign 0.5    
                                text choice3._ChoiceText yalign 0.5
                            
                    if (choice4 <> None):
                         hbox:
                            xsize 1300
                            yalign 0.5

                            frame:
                                background choice4._ChoiceImage
                                xysize 64, 64
                                xalign 0

                                imagebutton:
                                    idle "Graphics/GUI/choiceboxoptions.png"
                                    hover "Graphics/GUI/options_hover.png"
                                    selected_idle "Graphics/GUI/options_hover.png"
                                    selected_hover "Graphics/GUI/options_hover.png"
                                    hovered [choiceToolTip.Action(choice4._ToolTip), choice4Text.Action(choice4._ChoiceText)]
                                    action Return(ChoicesDTO("", "", "", "Choose4", choice4._ChoiceText))
                            frame:
                                background None
                                yalign 0.5
                                xsize 1200
                                ysize 115
                                #text choice4Text.value yalign 0.5       
                                text choice4._ChoiceText yalign 0.5

                    text choiceToolTip.value xalign 0.5 color "#EE0000"  size 18 italic True
Image

drKlauz
Veteran
Posts: 239
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: Can I rescale the background image of a frame dynamicall

#6 Post by drKlauz »

Ryue wrote:My question is: Is it possible to tell the background to be of a specific height? (thus scale it inside the screen)?
Look there, should help i guess https://www.renpy.org/doc/html/displayables.html#Frame
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Can I rescale the background image of a frame dynamicall

#7 Post by Ryue »

drKlauz wrote:
Ryue wrote:My question is: Is it possible to tell the background to be of a specific height? (thus scale it inside the screen)?
Look there, should help i guess https://www.renpy.org/doc/html/displayables.html#Frame
its the "python" Frame you are refering to. Isn't that though the equivalent for the Frame I'm using?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Can I rescale the background image of a frame dynamicall

#8 Post by xela »

No, it's completely different, it's also what you need here :)
Like what we're doing? Support us at:
Image

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Can I rescale the background image of a frame dynamicall

#9 Post by Ryue »

xela wrote:No, it's completely different, it's also what you need here :)
How is it used inside the screen?

Code: Select all

screen xyz:
    test = Frame("choices.png", 500, 100)
    .....
    frame: 
        background  test

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Can I rescale the background image of a frame dynamicall

#10 Post by xela »

Ryue wrote:
xela wrote:No, it's completely different, it's also what you need here :)
How is it used inside the screen?

Code: Select all

screen xyz:
    test = Frame("choices.png", 500, 100)
    .....
    frame: 
        background  test
No, the "500, 100" arguments are not realistic values, those are boarders and not dimensions.

Code: Select all

frame:
    blackground Frame("choices.png")
will do in most cases. You can use padding if you want there to be a bit of space between boarders and content.
Like what we're doing? Support us at:
Image

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Can I rescale the background image of a frame dynamicall

#11 Post by Ryue »

Ok that was it tnx

Post Reply

Who is online

Users browsing this forum: No registered users