How to move text inside Textbutton?

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
Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

How to move text inside Textbutton?

#1 Post by Nero »

So lets say I got simple Textbutton that does nothing text inside it by default will be in center question is how do i move it around the textbutton area? Is that even possible? Like if i do xalign whole button will be moved obviously how to do it just for the text inside the textbutton?

Code: Select all

init python:
    #This controls minimum button length
    style.companionstats = Style(style.frame)
    style.companionstats_button.xmaximum = 115
    style.companionstats_button.xminimum = 115

Code: Select all

screen test:
    frame:
        style_group "companionstats"
        xalign 0.500
        yalign 0.500
        vbox:
            textbutton "BUTTON"

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: How to move text inside Textbutton?

#2 Post by Remix »

textbutton "Text" ... text_{any text style property} value

Text style properties

textbutton "Text" ... text_text_align 0.1
should move it left

or text_style style.some_var_you_set_in_gui

Note: Untested, just surmised from TextButton class. Also, that is new gui, so might not work on older versions
Frameworks & Scriptlets:

Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

Re: How to move text inside Textbutton?

#3 Post by Nero »

Tried it and it doesn't work :/ . In documentation it was really confusing for me to have property named "text_-" this "-" is clearly not needed there. This one looks like a Ren'Py bug by documentation "text_text_align 0.1" should be working

User avatar
shin.e.d
Newbie
Posts: 22
Joined: Sat Jan 10, 2015 10:50 am
Projects: Data Lion and an unnamed bxb game with dinosaurs!
Contact:

Re: How to move text inside Textbutton?

#4 Post by shin.e.d »

How about this?

Code: Select all

style x_button is frame:
    xsize 315

style x_button_text:
    xalign 0.0 yalign 0.5

screen x:
    frame:
        xalign 0.5 yalign 0.5
        vbox:
            style_prefix "x"
            textbutton "button" action NullAction()
            

Nero
Veteran
Posts: 248
Joined: Tue Aug 09, 2016 2:59 pm
Contact:

Re: How to move text inside Textbutton?

#5 Post by Nero »

Ah finally it works thank you!

Still not sure why this what Remix said wont work even it is explained in documentation and by logic it should be working .

Post Reply

Who is online

Users browsing this forum: Exiscoming, Google [Bot], Semrush [Bot]