App
Hold the data of a generated UI and handle its events.
Subclass App with one handler(self, event) method per
@Callback handler, and optionally setup(self). A generated
UI(app) is the widget; the app works without one, for example to
call a handler in a test.
Notes
Set on_error to receive handler exceptions as on_error(handler, error) instead of raising them, and agent to receive
ask_agent(message, context) calls.
Attributes
attributeuiAny= NoneattributeagentCallable[[str, Any], None] | None= Noneattributeon_errorCallable[[str, Exception], None] | None= NoneFunctions
constructor__init__(**namespace) -> NoneparamnamespaceAny= {}Returns
Nonefuncset_ui(ui) -> NoneKeep ui as self.ui and run setup; a generated UI(app) calls it.
paramuiAnyReturns
Nonefuncsetup() -> NoneFill the UI after it is built; override it to load data into widgets.
Returns
Nonefunccall(handler, *args) -> NoneRun the handler method with args, passing an exception to on_error when set.
paramhandlerstrparamargsAny= ()Returns
Nonefuncask_agent(message, context=None) -> NoneSend message to the workbench agent; warns when no agent is attached.
parammessagestrparamcontextAny= NoneReturns
None