[SOLVED] Centering textbox text.

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
Biotikos
Regular
Posts: 33
Joined: Sat Jan 19, 2013 4:50 pm
Projects: Eien no Mirai
Organization: Biotikos Development
Skype: aleatory-22
Contact:

[SOLVED] Centering textbox text.

#1 Post by Biotikos »

I'll be brief.
I want to center the text of the textbox, but I don't know how the hell - just managed to place the text in the center setting left padding to 570 but not the disposal, so it appears like this:

Image

Does somebody knows how can I center the text in all the texts that will appear in the textbox?

and sorry about my childish english but I'm spanish and I express myself quite badly so
Last edited by Biotikos on Tue Nov 05, 2013 11:50 am, edited 1 time in total.

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

Re: Centering textbox text.

#2 Post by Alex »

You can set text xalign for each character individually or change the styles for entire project

Code: Select all

init  python:
    style.say_thought.xalign=0.5
    style.say_dialogue.xalign=0.5
(place mouse pointer over an item on the screen then hit shift +i to see what styles it has)

User avatar
Biotikos
Regular
Posts: 33
Joined: Sat Jan 19, 2013 4:50 pm
Projects: Eien no Mirai
Organization: Biotikos Development
Skype: aleatory-22
Contact:

Re: Centering textbox text.

#3 Post by Biotikos »

It seems I didn't explain myself correctly; I apologize.

What I want is that the text appears centered, just like if you used "center" tag in BBcode / HTML.
You know what I mean?

Tsapas
Regular
Posts: 69
Joined: Mon Oct 14, 2013 8:18 am
Contact:

Re: Centering textbox text.

#4 Post by Tsapas »

I guess you could use the centered property to auto-center your text. Justify could be useful as well to eliminate any weird line-to-line alignment.

User avatar
Biotikos
Regular
Posts: 33
Joined: Sat Jan 19, 2013 4:50 pm
Projects: Eien no Mirai
Organization: Biotikos Development
Skype: aleatory-22
Contact:

Re: Centering textbox text.

#5 Post by Biotikos »

Isn't there a way to center all the text in the textbox and the dialogue/thoughts in all the game? ;_;
Sorry for short message but idk I understood but it wasn't what I was actually searching

Tsapas
Regular
Posts: 69
Joined: Mon Oct 14, 2013 8:18 am
Contact:

Re: Centering textbox text.

#6 Post by Tsapas »

Ah, for this you need (after a bit of trial and error)

Code: Select all

init:
    $ style.say_vbox.xfill = True                  # this spans the dialogue vbox over the entire available area
    $ style.say_dialogue.xcenter = 0.5             # this centers any line of text
    $ style.say_dialogue.text_align = 0.5          # this centers wrapped text for sentences longer than one line
    $ style.say_label.xcenter = 0.5                # same goes for character names
    $ style.say_label.text_align = 0.5             # this is probably not needed as rarely any character names are longer than a full line, but what the hell
Get this in any file (I did it in screens.rpy for consistency) to add/override text properties. This way every text line and every character name will be centered properly.

User avatar
Biotikos
Regular
Posts: 33
Joined: Sat Jan 19, 2013 4:50 pm
Projects: Eien no Mirai
Organization: Biotikos Development
Skype: aleatory-22
Contact:

Re: Centering textbox text.

#7 Post by Biotikos »

It worked! Thank you very much ><

Post Reply

Who is online

Users browsing this forum: Bing [Bot], cruisy__, Google [Bot], Imperf3kt, Ocelot