style.rebuild - Ren'Py Visual Novel Engine

documentation index ◦ reference manual ◦ function index

# style.rebuild

Function: | style.rebuild | ():

This causes all styles to be rebuilt, making it possible to change styles outside of init code. There are several caveats:

- Changes to styles are not saved.
- Changes to styles persist through a game restart.
- Changes to indexed styles will be ignored unless the indexed style was first defined in an init block.

    init python:
        font = "DejaVuSans.ttf"
        style.default.font = font

        def change_font(newfont):
             global font
             font = newfont
             style.default.font = newfont
             style.rebuild()

    label after_load:
        python:
            style.default.font = font
            style.rebuild()

documentation index ◦ reference manual ◦ function index