[solved] xalign 1.0 doesn't move my text to the right side

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
HochElf
Newbie
Posts: 12
Joined: Tue Apr 02, 2019 4:16 am
Deviantart: HochElf
Contact:

[solved] xalign 1.0 doesn't move my text to the right side

#1 Post by HochElf »

Hi, wasn't active with RenPy in a long time and thought with the new version I could go back and have some fun.
So I wrote a little screen for my Interface but instead of separating the two items in the hbox "xalign"' seems to be ignored.

Code: Select all

screen scr_topBar():
    frame:
        xpos 0
        ypos 0
        xsize 1280
        ysize 75

        hbox:
            xsize 1280
            text s_location
            text "€" + str(mc.i_cash) xalign 1.0    #this part should be at the right side of my bar
Last edited by HochElf on Thu Jan 07, 2021 4:34 am, edited 1 time in total.

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: xalign 1.0 doesn't move my text to the right side

#2 Post by _ticlock_ »

Hi, HochElf,

You don't need hbox for that:

Code: Select all

screen scr_topBar():
    frame:
        xpos 0
        ypos 0
        xsize 1280
        ysize 75
        text s_location
        text "€" + str(mc.i_cash) xalign 1.0
EDIT:
Alternatively, you can use xfill attribute:

Code: Select all

screen scr_topBar():
    frame:
        xpos 0
        ypos 0
        xsize 1280
        ysize 75
        hbox:
            xminimum 1280
            xfill True
            text s_location
            text "€" + str(mc.i_cash) xalign 1.0

HochElf
Newbie
Posts: 12
Joined: Tue Apr 02, 2019 4:16 am
Deviantart: HochElf
Contact:

Re: xalign 1.0 doesn't move my text to the right side

#3 Post by HochElf »

Thanks, that resolved the problem on the visual part, but not on the understanding part. What did I make wrong? Why didn't worked it out in an hbox?

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: xalign 1.0 doesn't move my text to the right side

#4 Post by _ticlock_ »

I think it makes everything clear if you change text to textbutton and add background:
Compare:

Code: Select all

hbox:
    xsize 1280
    textbutton s_location background "#888"
    textbutton "€" + str(mc.i_cash) xalign 1.0 background "#808"   #this part should be at the right side of my bar
VS:

Code: Select all

hbox:
    xsize 1280
    xfill True
    textbutton s_location background "#888"
    textbutton "€" + str(mc.i_cash) xalign 1.0 background "#808"   #this part should be at the right side of my bar
Even if hbar size is full width it does not use whole width, unless you specify to do it with xfill True.

HochElf
Newbie
Posts: 12
Joined: Tue Apr 02, 2019 4:16 am
Deviantart: HochElf
Contact:

Re: xalign 1.0 doesn't move my text to the right side

#5 Post by HochElf »

Ahh. So the hbox is dynamic within its with even with a set size. Didn't know that. Thank you very much. :)

Post Reply

Who is online

Users browsing this forum: No registered users