• To improve security, we will soon start forcing password resets for any account that uses a weak password on the next login. If you have a weak password or a defunct email, please update it now to prevent future disruption.

Ren'Py Assign font to textbutton [Solved]

NamesRed

Member
Game Developer
May 13, 2018
198
133
Hi, could someone inform me as to how I apply a font to a text button? The "font" keyword doesn't seem to be valid. Thank you.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,202
14,938
Can't assign any fonts to my textbutton's - says it's an invalid keyword. How do I fix this? I want to be able to assign fonts to buttons.
Like said in the documentation regarding Styles properties, "text buttons use two styles by default: button for the button itself, and button_text for the text inside the button". More basically, there's the style assigned to the button and, derived from it, the style assigned to the text.
So, for something like :
Code:
screen blabla:
    textbutton "abc" style "myStyle"
You'll have "myStyle" which apply to the button, and "myStyle_text" which apply to the text inside this button.

In the end, to change the font of the text button:
Code:
style myStyle is button
style myStyle_text is button_text:
    font "MyFont"
 

NamesRed

Member
Game Developer
May 13, 2018
198
133
Like said in the documentation regarding Styles properties, "text buttons use two styles by default: button for the button itself, and button_text for the text inside the button". More basically, there's the style assigned to the button and, derived from it, the style assigned to the text.
So, for something like :
Code:
screen blabla:
    textbutton "abc" style "myStyle"
You'll have "myStyle" which apply to the button, and "myStyle_text" which apply to the text inside this button.

In the end, to change the font of the text button:
Code:
style myStyle is button
style myStyle_text is button_text:
    font "MyFont"
Thank you, that's exactly what I was looking for. Examples are really lacking on the Ren'Py wiki.