Can vbox take a combination of texts and images 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
User avatar
sapiboonggames
Veteran
Posts: 299
Joined: Thu Jan 05, 2012 8:53 am
Completed: I Love You, Brother [BxB]
Contact:

Can vbox take a combination of texts and images inside?

#1 Post by sapiboonggames »

So, as the subject states...
I know that vbox can take textbutton and text inside.

For ex:

Code: Select all

vbox:
    textbutton "Do this"
    textbutton "Do that"
My question is, can vbox take something more complicated such as a combination of texts and images?
If yes, how should I proceed with it?

I tried putting this code but it won't work: (the second entree overlaps with the first entree, I guess vbox can't take in frame?)

Code: Select all

    vbox:
        spacing 10
        side "c r":
            area (392, 272, 845, 446)
            viewport id "tweet_list":
                draggable True mousewheel True
                frame: 
                    has vbox
                    for i in tweet:
                       fixed:
                          add "socialmedia/tweetbackground.png"
                          add i.sender_avatar xpos 9 ypos 9 
                          text i.dateandtime xpos 103 ypos 9 font "Roboto-Regular.ttf" size 12 color "#000000"
                          vbox:
                            area (104, 27, 726, 66)
                            text i.content font "Roboto-Regular.ttf" size 18 color "#000000"
I really hope someone can help with this problem.
Thank you! :)
Visit my website: http://www.sapiboong.com

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2401
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Can vbox take a combination of texts and images inside?

#2 Post by Ocelot »

Well, your problem is that vbox has only one child: side. Anything inside side is handled by side displayable itself.

Vbox can handle arbitrary complex screens. Here is an example (cut down, so it might not work as-is)

Code: Select all

    vbox:
        text(character.localized_name)
        showif character.relationship == 'aquired':
            fixed:
                xfill True
                ysize 180
                add 'icon_%s.png' % (character.level() + 1) align (0.5, 0.5)
                text _('{color=#0b0}{size=+8}[character.battle_won]{/size}\nWon{/color}') align (0.0, 1.0)
                text _('{color=#e00}{size=+8}[character.battle_lost]{/size}\nLost{/color}') align (1.0, 1.0) text_align 1.0
            text _('Position: [character.position]') xalign 0.5
            label _("Training")
            bar:
                style 'training_bar'
                xsize ssize - 24
                value character.training_level()
                range 5
        else:
            null height 273
        label _("Friendship")
        bar:
            style 'two_sided_bar'
            xsize ssize - 24
            value character.friendship + 100
            range 200
        viewport:
            mousewheel True
            scrollbars "vertical"
            text(character.description)
< < insert Rick Cook quote here > >

User avatar
sapiboonggames
Veteran
Posts: 299
Joined: Thu Jan 05, 2012 8:53 am
Completed: I Love You, Brother [BxB]
Contact:

Re: Can vbox take a combination of texts and images inside?

#3 Post by sapiboonggames »

Ocelot wrote:Well, your problem is that vbox has only one child: side. Anything inside side is handled by side displayable itself.

Vbox can handle arbitrary complex screens. Here is an example (cut down, so it might not work as-is)

Code: Select all

    vbox:
        text(character.localized_name)
        showif character.relationship == 'aquired':
            fixed:
                xfill True
                ysize 180
                add 'icon_%s.png' % (character.level() + 1) align (0.5, 0.5)
                text _('{color=#0b0}{size=+8}[character.battle_won]{/size}\nWon{/color}') align (0.0, 1.0)
                text _('{color=#e00}{size=+8}[character.battle_lost]{/size}\nLost{/color}') align (1.0, 1.0) text_align 1.0
            text _('Position: [character.position]') xalign 0.5
            label _("Training")
            bar:
                style 'training_bar'
                xsize ssize - 24
                value character.training_level()
                range 5
        else:
            null height 273
        label _("Friendship")
        bar:
            style 'two_sided_bar'
            xsize ssize - 24
            value character.friendship + 100
            range 200
        viewport:
            mousewheel True
            scrollbars "vertical"
            text(character.description)
I see.
So instead of using the side to make the area scrollable, I should try to follow the example code?
Thanks for the help! will be trying the code tomorrow (since it is 2AM here already haha)
Visit my website: http://www.sapiboong.com

Post Reply

Who is online

Users browsing this forum: apocolocyntose, DewyNebula