trame.decorators package

class trame.decorators.TrameApp(server='server', namespace='')

Bases: object

Class Decorator for trame application. This decorator can be used to automatically register methods to state.change, controller, trigger and life_cycle. The parameter are used to define where to fine the server instance within the object and where a namespace for the variable name is stored.

@TrameApp()
class ExampleApp:
    def __init__(self):
        self.server = get_server()

    @change("var_name_1", "var_name_n")
    def on_state_change(**kwargs):
        pass

    @controller.set("hello")
    def hello(**kwargs):
        pass
trame.decorators.change(*args)

Method decorator for state change

trame.decorators.trigger(*args)

Method decorator to assign a trigger name to a function

trame.decorators.hot_reload(func)

Decorator to reload the function on every call

If there are multiple decorators on this function, only the decorators after the @hot_reload decorator will be reloaded

Submodules