How to work with gui.properties?

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
zmook
Veteran
Posts: 421
Joined: Wed Aug 26, 2020 6:44 pm
Contact:

How to work with gui.properties?

#1 Post by zmook »

Does anyone have a useful guide they can point me at on how to work with gui.properties without tearing out my hair? How do I figure out what any given style is actually inheriting from, and how do I modify that without having everything immediately become a giant hairball?

I look at something like:

Code: Select all

style game_menu_label is gui_label
style game_menu_label_text is gui_label_text
And how do I know what that's actually going to produce? If I search my whole project, I find a bunch of things that "are" gui_label, but nothing that says what gui_label *is*.

Obviously it must come by magic out of gui.rpy somehow, but the only things that mention "label" define a text size, but somehow it gets a font and a color from somewhere, I don't know how.

By process of elimination, it must somehow get assigned to gui.accent_color, but damned if I can see how.

So, I want to change the color of the titles in game_menu. I don't really want to just edit the value of gui.accent_color because I can't see any way to actually know how much collateral damage that will cause (what *else* uses gui.accent_color? No idea.) I tried

Code: Select all

style game_menu_label_text is gui_text
style game_menu_label_text:
    color "#0f0"
and amazingly this doesn't work. The color of game_menu_label_text is *still* getting set by gui.accent_color, it's just too powerful. How? I don't know.

Do I have to burn it all down and start over defining text styles that actually do what I want and I can figure out where and how they're used?
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM

User avatar
m_from_space
Miko-Class Veteran
Posts: 974
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: How to work with gui.properties?

#2 Post by m_from_space »

zmook wrote: Sun Jun 26, 2022 6:57 pm

Code: Select all

style game_menu_label_text is gui_text
style game_menu_label_text:
    color "#0f0"
and amazingly this doesn't work. The color of game_menu_label_text is *still* getting set by gui.accent_color, it's just too powerful. How? I don't know.
Haha, I also found this customization a bit of a pain in the ass when it comes to figuring out where things are actually getting defined.

In your case maybe you overlooked that game_menu_label_text is set again when you scroll down a bit?

On the other hand make sure you know what you are doing. Because "game_menu_label_text" just refers to labels* (!) - not text objects - inside the screen "game_menu". I actually don't use labels inside the game_menu screen, but just put a text object there with a specific color.

*by that I mean those objects https://www.renpy.org/doc/html/screens. ... abel#label (not the labels that are part of renpy logic of course)

Code: Select all

screen game_menu(title, scroll=None, yinitial=0.0):
    style_prefix "game_menu"
    text title color "#0f0"
    ...

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: How to work with gui.properties?

#3 Post by Imperf3kt »

You can find these default style definitions in
C:/Program Files (x86)/renpy/renpy/common/00style.rpy
Assuming you installed Renpy to your C drive


I do not recommend editing the files in renpy/common, instead if you must edit things, copy the file to your own project, and save it with a different name. Edit things in there, although this is hardly how I would suggest editing anything - all the tools you will require are generally within gui.rpy
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
zmook
Veteran
Posts: 421
Joined: Wed Aug 26, 2020 6:44 pm
Contact:

Re: How to work with gui.properties?

#4 Post by zmook »

Imperf3kt wrote: Mon Jun 27, 2022 4:13 am You can find these default style definitions in
C:/Program Files (x86)/renpy/renpy/common/00style.rpy
Ah, okay. I don’t really want to have to look in 3 or more places (screens.rpy, gui.rpy, and 00style.rpy) to decipher how the styles work — do you think it’s worth it?

I guess I’ll just have to figure it out and then decide what to do. I really want a style hierarchy that makes sense when I search on names. “Ah, this uses a wombat_button_text. What is that? let me quickly find it.”

Unless there’s a helpful Best Practices guide or something? I don’t *want* to waste my time re-writing all the styles, but right now it seems so opaque.
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM

User avatar
zmook
Veteran
Posts: 421
Joined: Wed Aug 26, 2020 6:44 pm
Contact:

Re: How to work with gui.properties?

#5 Post by zmook »

m_from_space wrote: Mon Jun 27, 2022 1:19 am Haha, I also found this customization a bit of a pain in the ass when it comes to figuring out where things are actually getting defined.
Glad I’m not alone.
In your case maybe you overlooked that game_menu_label_text is set again when you scroll down a bit?
Oh FFS.
I actually don't use labels inside the game_menu screen, but just put a text object there with a specific color.
Yeah, the default game_menu uses ‘label title’.
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: How to work with gui.properties?

#6 Post by Imperf3kt »

zmook wrote: Mon Jun 27, 2022 7:19 am
Imperf3kt wrote: Mon Jun 27, 2022 4:13 am You can find these default style definitions in
C:/Program Files (x86)/renpy/renpy/common/00style.rpy
Ah, okay. I don’t really want to have to look in 3 or more places (screens.rpy, gui.rpy, and 00style.rpy) to decipher how the styles work — do you think it’s worth it?

I guess I’ll just have to figure it out and then decide what to do. I really want a style hierarchy that makes sense when I search on names. “Ah, this uses a wombat_button_text. What is that? let me quickly find it.”

Unless there’s a helpful Best Practices guide or something? I don’t *want* to waste my time re-writing all the styles, but right now it seems so opaque.
It's designed to work out of the box with no real need to change anything.

While you certainly can style things and are encouraged to do so, I don't see why you consider that wasting time? You're making a game, some effort will be required if you want to customise things beyond the basic control that gui.rpy allows.

Generally, it is more than enough. The labels and styles you are referring to can largely be ignored.


If you want to fully customise the style definitions and everything, I would suggest looking at the zero gui in the cookbook
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Post Reply

Who is online

Users browsing this forum: Google [Bot]