Changing style props locally for one screen element

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
Levrex
Veteran
Posts: 280
Joined: Mon Jun 18, 2012 12:16 pm
Contact:

Changing style props locally for one screen element

#1 Post by Levrex »

Basically, i have a screen with a frame which includes a vbox (placed on the right side of the screen) with several textbuttons with uneven length text in them. Currently all textbuttons are aligned to the left, their text is too small and is not bright enough when inactive.
I want to change the size and color of all textbuttons in that vbox and align them to right, but i can't change the current style properties, because the style is being used in a lotta other screens.
Is there any way to do this other than creating an another style or adding the size and xalign properties to each button? (There'd be like 40 buttons, not just 2, so the latter would be too bothersome and senseless.)
I. e., is there any way to specify the style properties in a screen, just like the position of a vbox and background of a frame?

That's how the screen looks like:

Code: Select all

frame:
        style_group "quick"
        background "#fff2"

        text "#######" xalign 0.5 yalign 0.0 font "Times.ttf" size 24

        vbox:
            xalign 0.97
            yalign 0.35

            textbutton _("###") action [Hide("scenario_jump_tumi_2", transition=spiral2), SetVariable("start_chapter", "tumi_day01"), Start("smooth_transition")]
            textbutton _("#############") action [Hide("scenario_jump_tumi_2", transition=spiral2), SetVariable("start_chapter", "tumi_day02"), Start("smooth_transition")]
If your question is solved, please add [Solved] to theme's name by editing its first post, so that the helpful guys out there wouldn't mistakenly think the problem is still unanswered and waste their time.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Changing style props locally for one screen element

#2 Post by xela »

What's stopping from inheriting all properties of "quick" style group and changing just the font color and layout of buttons? It's not like styles are slow these days and it would require about 5 - 6 lines of code at most. I am sure if you dig enough into Ren'Py, you'll find some way to hack this issue but with a 5 line proper solution in accordance with documentation, why even bother...?

If you're asking for another quick way, I don't think there is one...

*It should be noted that if all/most of your buttons are chapters loading logically similar data, you could just use a dict with a for loop and a single button. Would look a lot cleaner.
Like what we're doing? Support us at:
Image

Levrex
Veteran
Posts: 280
Joined: Mon Jun 18, 2012 12:16 pm
Contact:

Re: Changing style props locally for one screen element

#3 Post by Levrex »

That's a bit disappointing. Well, i'll just go with the style then.

About * — that's a matter of habit, really.
If your question is solved, please add [Solved] to theme's name by editing its first post, so that the helpful guys out there wouldn't mistakenly think the problem is still unanswered and waste their time.

Post Reply

Who is online

Users browsing this forum: No registered users