Compute Blocks
Form
¶
Create a form on the page that runs the provided function on submit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
on_submit |
FunctionT
|
Function to run when the form is submitted |
required |
controls |
ControlsT
|
Parameters for the Form |
None
|
target |
optional
|
Where the results from the function should be viewed |
TargetMode.BELOW
|
label |
optional
|
Description for the Form |
None
|
submit_label |
str
|
Label for the submit button |
'Go'
|
cache |
bool
|
Hint that the on_submit function may be cached |
False
|
¶
Dynamic
¶
Create a dynamically updating block that runs the provided function to update the View.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
on_load |
t.Optional[FunctionT]
|
Function to run when the App is loaded |
None
|
on_timer |
t.Optional[FunctionT]
|
Function to run on a regular timer |
None
|
target |
optional
|
Where the results from the function should be viewed |
None
|
seconds |
optional, default=30
|
Number of seconds between running the function specified by on_timer |
30
|
immediate |
optional, default=False
|
Run the specified function immediately on page load |
False
|
¶
Compute
¶
Compute blocks allow for dynamic views based on running python functions that return blocks
Create a compute block that runs the provided function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function |
FunctionT
|
Function to run |
required |
target |
TargetT
|
Where the results from the function should be viewed |
required |
controls |
ControlsT
|
Parameters for the Form |
None
|
swap |
Swap
|
The mechanism to replace the referenced block |
Swap.REPLACE
|
trigger |
Trigger
|
How the function is called |
Trigger.SUBMIT
|
cache |
bool
|
Hint that the function output may be cached |
False
|