[SOLVED] Need help center aligning my textbox

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
GeeSeki
Regular
Posts: 112
Joined: Sat Dec 17, 2016 3:39 am
Projects: A Town Uncovered
itch: geeseki
Contact:

[SOLVED] Need help center aligning my textbox

#1 Post by GeeSeki »

I have a dialogue box that is used without a namebox. I labelled it narrator. The dialogue box itself isn't the same full width of the window so it's currently at the bottom left. How do I make it so it's centered in the xposition? The window_background_xalign=0.5 was a total guess based on what I found, it doesn't work.

Code: Select all

define narrator = Character(None, window_background_xalign=0.5, window_background="gui/gui_textbox_narr.png")
Last edited by GeeSeki on Wed Jul 25, 2018 12:01 am, edited 1 time in total.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Need help center aligning my textbox

#2 Post by Per K Grok »

GeeSeki wrote: Mon Jul 23, 2018 1:38 am I have a dialogue box that is used without a namebox. I labelled it narrator. The dialogue box itself isn't the same full width of the window so it's currently at the bottom left. How do I make it so it's centered in the xposition? The window_background_xalign=0.5 was a total guess based on what I found, it doesn't work.

Code: Select all

define narrator = Character(None, window_background_xalign=0.5, window_background="gui/gui_textbox_narr.png")
The position of the background image can be set in "style window" in screens.rpy

Code: Select all

style window:
    xalign 0.5
    xfill True
    yalign gui.textbox_yalign
    ysize gui.textbox_height
    background Image("gui/textbox.png", xalign=0.5, yalign=1.0)
You could make a "style window2" for your narrator and then call that in the definition

Code: Select all

define narrator = Character(None, window_style="window2")

User avatar
GeeSeki
Regular
Posts: 112
Joined: Sat Dec 17, 2016 3:39 am
Projects: A Town Uncovered
itch: geeseki
Contact:

Re: Need help center aligning my textbox

#3 Post by GeeSeki »

Thanks so much for the fix man! It works perfectly.

Post Reply

Who is online

Users browsing this forum: Google [Bot]