Centering text in vbox [SOLVED]

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
OddTillTheEnd
Regular
Posts: 43
Joined: Wed Jun 04, 2014 3:45 pm
Completed: Broken Minds (2017), Prison of Lies (2019), Methods (2020), Catalyst Wake (2021)
Projects: JPDE2: Adagio of Darkness (Early access), Blankspace (2020), The Elevator Game with Catgirls
Organization: LockedOn Games
Soundcloud: OddTillTheEnd
itch: lockedon
Contact:

Centering text in vbox [SOLVED]

#1 Post by OddTillTheEnd »

Well, I've looked everywhere I can to find a solution to this, but it remains elusive.

Basically, I have text in a vbox, enclosed in a frame.
I can't use xfill to properly center the text in the middle of the screen, because it's not in a displayable that can change size.
This means that the text appears on the left side of the frame it's contained in, instead of being centered properly in the middle of the screen.

All the other questions I've seen regarding this involved windows and not frames.

Code: Select all

screen TEST:
    frame:
        background None
        xpadding 2
        ypadding 2
        xalign 0.5
        yalign 0.5
        xsize 500
        ysize 500
        vbox:
                text "Golly gee, I'm not centered!" text_align 0.5
Thanks,
— Odd.
Last edited by OddTillTheEnd on Tue May 23, 2017 1:00 pm, edited 1 time in total.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Centering text in vbox

#2 Post by Divona »

Code: Select all

screen TEST:
    frame:
        background None
        xpadding 2
        ypadding 2
        xalign 0.5
        yalign 0.5
        xsize 500
        ysize 500

        vbox:
            xfill True

            text "Golly gee, I'm centered!" xalign 0.5
Completed:
Image

User avatar
OddTillTheEnd
Regular
Posts: 43
Joined: Wed Jun 04, 2014 3:45 pm
Completed: Broken Minds (2017), Prison of Lies (2019), Methods (2020), Catalyst Wake (2021)
Projects: JPDE2: Adagio of Darkness (Early access), Blankspace (2020), The Elevator Game with Catgirls
Organization: LockedOn Games
Soundcloud: OddTillTheEnd
itch: lockedon
Contact:

Re: Centering text in vbox

#3 Post by OddTillTheEnd »

Divona wrote:

Code: Select all

screen TEST:
    frame:
        background None
        xpadding 2
        ypadding 2
        xalign 0.5
        yalign 0.5
        xsize 500
        ysize 500

        vbox:
            xfill True

            text "Golly gee, I'm centered!" xalign 0.5
*facepalm*
Thanks so much, Divona!

— Odd.

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Ocelot