Module albow.themes.FontProperty
Source code
from albow.themes.Theme import Theme
from albow.themes.ThemeProperty import ThemeProperty
class FontProperty(ThemeProperty):
    """
    The FontProperty class is a property descriptor used for defining theme properties whose values are font objects.
    Rather than an actual font object, the corresponding attribute of a Theme object should contain a
    tuple (size, filename) specifying the font. The first time the font property is accessed for a
    given instance, the FontProperty descriptor loads the font using get_font and caches the resulting font object.
    Example
    --------
    ```python
        class DramaticScene(Widget):
        villain_gloat_font = FontProperty('villain_gloat_font')
        from albow.themes.Theme import themeRoot
        themeRoot.DramaticScene = theme.Theme('DramaticScene')
        themeRoot.DramaticScene.villain_gloat_font = (27, "EvilLaughter.ttf")
    ```
    """
    def __init__(self, name):
        """
        Constructs a font property descriptor.
        Args:
            name: Normally name should be the same as the name being used for the property.
        """
        super().__init__(name)
    def get_from_theme(self, cls, name):
        return Theme.getThemeRoot().get_font(cls, name)Classes
- class FontProperty (name)
- 
The FontProperty class is a property descriptor used for defining theme properties whose values are font objects. Rather than an actual font object, the corresponding attribute of a Theme object should contain a tuple (size, filename) specifying the font. The first time the font property is accessed for a given instance, the FontProperty descriptor loads the font using get_font and caches the resulting font object. Exampleclass DramaticScene(Widget): villain_gloat_font = FontProperty('villain_gloat_font') from albow.themes.Theme import themeRoot themeRoot.DramaticScene = theme.Theme('DramaticScene') themeRoot.DramaticScene.villain_gloat_font = (27, "EvilLaughter.ttf")Constructs a font property descriptor. Args- name
- Normally name should be the same as the name being used for the property.
 Source codeclass FontProperty(ThemeProperty): """ The FontProperty class is a property descriptor used for defining theme properties whose values are font objects. Rather than an actual font object, the corresponding attribute of a Theme object should contain a tuple (size, filename) specifying the font. The first time the font property is accessed for a given instance, the FontProperty descriptor loads the font using get_font and caches the resulting font object. Example -------- ```python class DramaticScene(Widget): villain_gloat_font = FontProperty('villain_gloat_font') from albow.themes.Theme import themeRoot themeRoot.DramaticScene = theme.Theme('DramaticScene') themeRoot.DramaticScene.villain_gloat_font = (27, "EvilLaughter.ttf") ``` """ def __init__(self, name): """ Constructs a font property descriptor. Args: name: Normally name should be the same as the name being used for the property. """ super().__init__(name) def get_from_theme(self, cls, name): return Theme.getThemeRoot().get_font(cls, name)AncestorsMethods- def get_from_theme(self, cls, name)
- 
Source codedef get_from_theme(self, cls, name): return Theme.getThemeRoot().get_font(cls, name)