Different font for textbuttons

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
netravelr
Miko-Class Veteran
Posts: 504
Joined: Thu Jan 28, 2010 2:31 am
Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
Projects: Love at the Laundromat
Organization: Lakeview Interactive
Deviantart: netravelr
Location: USA
Contact:

Different font for textbuttons

#1 Post by netravelr »

I know there has to be a variable somewhere that I'm missing as I'm trying to set variables to change the behavior of textbuttons to be different than style.default . Shouldn't ui.textbutton.font work? I know I can hardcode it per button with {font=} but for the amount of buttons my project has I'd very much would like to change it in one place. Been wrestling with it for around 2 hours looking around both here and the RenPy site so I thought I'd just ask to see if anyone knew off hand.

Any ideas?
Image
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."

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

Re: Different font for textbuttons

#2 Post by Alex »


User avatar
netravelr
Miko-Class Veteran
Posts: 504
Joined: Thu Jan 28, 2010 2:31 am
Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
Projects: Love at the Laundromat
Organization: Lakeview Interactive
Deviantart: netravelr
Location: USA
Contact:

Re: Different font for textbuttons

#3 Post by netravelr »

I tried using something similar to what was told there, but I'm sure I'm missing something...

Code: Select all

    python:
        style.button['Button'].font = "Crystal_Deco.ttf"
        while True:
            ui.frame(xalign=0,yalign=.5)
            ui.vbox()
            ui.text("[mc.name] House")
            ui.textbutton("{font=Crystal_Deco.ttf}Set Up", clicked=ui.returns(("setup", True)), xminimum=250, style=style.button['Button'], text_style=style.button_text['Foo']) 
ui.close() 
Image
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."

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

Re: Different font for textbuttons

#4 Post by Alex »

Did this code worked for you? Did you get an error message or unexpected behaviour?
[ 1) have you declared <style.button_text['Foo']>? 2) I'm afraid that <while True:> will hang your comp up... ]

User avatar
netravelr
Miko-Class Veteran
Posts: 504
Joined: Thu Jan 28, 2010 2:31 am
Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
Projects: Love at the Laundromat
Organization: Lakeview Interactive
Deviantart: netravelr
Location: USA
Contact:

Re: Different font for textbuttons

#5 Post by netravelr »

It compiles, but when executed nothing happens.... I don't know.
Image
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Different font for textbuttons

#6 Post by Aleema »

Here's how I personally do it. In an init python:

Code: Select all

style.create('s_button', 'button')
style.s_button.color = "#ffffff"

style.create('song_button_text', 'button_text')
style.song_button_text.color = "#BABABA"
For my button code:

Code: Select all

ui.textbutton("blah", style="s_button", text_style="song_button_text")
Or is that not what you meant?

Post Reply

Who is online

Users browsing this forum: 3N16M4