properties statement in style

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
felsenstern
Regular
Posts: 62
Joined: Tue Jul 11, 2017 2:13 am
Contact:

properties statement in style

#1 Post by felsenstern » Sun Dec 20, 2020 8:16 am

Hiya,

can someone please help me out explaining the following 3 lines to me?

style default:
properties gui.text_properties()
.
.
properties gui.text_properties("input", accent=True)

1. style default: where is it used (windows, frames ... and so on)? Does it need to be defined again somewhere or is it really a default value?

2. properties command: what is it doing what transfer parameter is it expecting (or where in the docs is it explained).

3. gui.text_properties(): what is it returning and where and how is this defined? It looks like a class property but then wouldn't empty round brackets after the call not cause an error? And then again I couldn't find it being defined somewhere in my rpy-files.

4. gui.text_properties("input", accent=True): what is this returning and why?

P.S.: I've read through the Style and the Style Properties Documentation a couple of times but without understanding the 3 lines above. And please, I know that I'm a noob and I really pondered over this for more than two weeks instead of continuing writing my game just to avoid asking this here.
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: properties statement in style

#2 Post by hell_oh_world » Sun Dec 20, 2020 9:26 am

1. it is the base style for all styles iirc. renpy creates that.
2. https://www.renpy.org/dev-doc/html/scre ... statements. it accepts a dict of styles you want to pass.

Code: Select all

style mystyle:
  properties dict(xsize=1.0, align=(0.5, 0.5))
is also the same as...

Code: Select all

style mystyle:
  properties {} # empty dict
  xsize 1.0
  align (0.5, 0.5)
3. https://www.renpy.org/doc/html/gui_adva ... properties. it's a function, not a class property. the kind parameter for that function is also found in the docs: https://www.renpy.org/doc/html/gui.html#text.
4. again, these functions return a dict of style properties.

felsenstern
Regular
Posts: 62
Joined: Tue Jul 11, 2017 2:13 am
Contact:

Re: properties statement in style

#3 Post by felsenstern » Sun Dec 20, 2020 10:26 am

First of all, thanks for answering, and thanks for the links. Allow me a few follow up questions.

1. dict is a kind of list in which entries can only exist one time?

2. if accent is not in the function parameters, then it's False?
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: properties statement in style

#4 Post by hell_oh_world » Sun Dec 20, 2020 11:06 am

1. Dict is some sort of basic data type in python aside from other objects such as list, tuples, int, etc. So you should learn more about it. Its a python thing so you can learn this from python courses.
Basically, imagine it as a list wherein instead of numbers as indices, you can use different objects as index.

Code: Select all

default a = [0]
default b = {"zero": 0, 1: 1} # equal to b = dict(zero=0), you cant do 1=1 in this kind of format so you can resort in the traditional way.

label start:
  $ print(a[0]) # with lists you are limited to int as index in accesing the element.
  $ print(b["zero"], b[1]) # with dicts you can use almost any object as index/key in accessing the element.
And of course each data type has their own pros and cons. Dicts are unordered while lists are ordered.
2. Depends if the parameter is optional. Still this is a python thing so you can learn this through python courses.

Code: Select all

init python:
  def fun(a, b=1): print(a, b)
  fun(10) # b is optional and defaults to 1
  fun(10, 5) # b is given a value of 5 instead of its default

felsenstern
Regular
Posts: 62
Joined: Tue Jul 11, 2017 2:13 am
Contact:

Re: properties statement in style

#5 Post by felsenstern » Sun Dec 20, 2020 11:29 am

Well, thanks a lot. This helped a lot.

And I bought a bundle full with python coding books a few months ago, but I just recently learned init python and that you can write python code inside renpy. So I will give it another try... ;-)
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

Post Reply

Who is online

Users browsing this forum: No registered users