I tried to set label properties like font and font size directly through adding the values after ‘label.property =’ but somehow it doesn’t work (and getting this error: “Invalid set index ‘font’ (on base: ‘Label’) with value of type ‘FontFile’.”). Then I managed to get it work through set() method. But I’m still curious, why is the first approach, which seems very intuitive to me, doesn’t work? I looked up in the documentation and found ‘font’ property does exist for labels. So strange! Then what type of variables is supported by the font property if not fontfile?
What’s more strange is that font_size property doesn’t support ints…
Because a Control may have multiple fonts or font sizes (like a RichTextLabel for example) so that information is part of a Theme (fonts, font sizes, styleboxes, colors, icons and constants) and to override them you need to use any of the Control.add_theme_<type>_override() functions.
To know which properties you can modify for each Control they are listed in the Theme Properties section of each Control documentation page. You can also see them in the inspector under Theme Overrides