Compute widgets
ComputeWidgetsMixin
¶
button
staticmethod
¶
button(key, on_click=None, args=None, kwargs=None, label='Click Me', show=True, help_text='')
Create a button widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Unique identifier for the widget. |
required |
|
Optional[Callable]
|
Callback function for the button. Defaults to None. |
None
|
|
Optional[Tuple]
|
Arguments for the callback function. Defaults to None. |
None
|
|
Optional[dict]
|
Keyword arguments for the callback function. Defaults to None. |
None
|
|
str
|
Label for the button. Defaults to "Click Me". |
'Click Me'
|
|
bool
|
Whether to show the widget in the report. Defaults to True. |
True
|
|
str
|
Help text for the button. Defaults to "". |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
Whether the button was clicked. |
checkbox
staticmethod
¶
checkbox(key, label='', value=False, disabled=False, description='', reference='', show=True, help_text='', helper_images=None)
Create a checkbox widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Unique identifier for the widget. |
required |
|
str
|
Label for the widget. Defaults to "". |
''
|
|
bool
|
Default value. Defaults to False. |
False
|
|
bool
|
Whether the widget is disabled. Defaults to False. |
False
|
|
str
|
Description of the widget. Defaults to "". |
''
|
|
str
|
Reference for the widget. Defaults to "". |
''
|
|
bool
|
Whether to show the widget in the report. Defaults to True. |
True
|
|
str
|
Help text for the widget. Defaults to ''. |
''
|
|
Optional[List[WidgetHelperImage]]
|
List of helper images for the widget. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
The value of the checkbox. |
data_filter
staticmethod
¶
data_filter(key, file_name, filter_columns, is_local=False, label='', value=None, disabled=False, description='', reference='', show=True, help_text='')
Create a data filter widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Unique identifier for the widget. |
required |
|
str
|
Name of the file to filter. |
required |
|
List[str]
|
List of columns to filter. |
required |
|
bool
|
Whether the file is local. Defaults to False. |
False
|
|
str
|
Label for the widget. Defaults to "". |
''
|
|
Optional[List[str]]
|
Default value. Defaults to None. |
None
|
|
bool
|
Whether the widget is disabled. Defaults to False. |
False
|
|
str
|
Description of the widget. Defaults to "". |
''
|
|
str
|
Reference for the widget. Defaults to "". |
''
|
|
bool
|
Whether to show the widget in the report. Defaults to True. |
True
|
|
str
|
Help text for the widget. Defaults to ''. |
''
|
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: The filtered data. |
download_button
staticmethod
¶
download_button(key, file, label='Download File', on_click=None, args=None, kwargs=None, show=True, help_text='')
Create a download button widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Unique identifier for the widget. |
required |
|
FileData
|
File to be downloaded. |
required |
|
str
|
Label for the button. Defaults to "Download File". |
'Download File'
|
|
Optional[Callable]
|
Callback function for the button. Defaults to None. |
None
|
|
Optional[Tuple]
|
Arguments for the callback function. Defaults to None. |
None
|
|
Optional[dict]
|
Keyword arguments for the callback function. Defaults to None. |
None
|
|
bool
|
Whether to show the widget in the report. Defaults to True. |
True
|
|
str
|
Help text for the button. Defaults to "". |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
Whether the button was clicked. |
file_uploader
staticmethod
¶
file_uploader(key, label='', value=None, max_size_mb=20, allowed_extensions=None, is_multiple=False, disabled=False, description='', reference='', show=True, help_text='')
Create a file uploader widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Unique identifier for the widget. |
required |
|
str
|
Label for the widget. Defaults to "". |
''
|
|
None | FileData | List[FileData]
|
Default value. Defaults to None. |
None
|
|
int
|
Maximum file size allowed in MB. Defaults to 20. |
20
|
|
Optional[List[str]]
|
List of allowed file extensions. Defaults to None. |
None
|
|
bool
|
Whether multiple files can be uploaded. Defaults to False. |
False
|
|
bool
|
Whether the widget is disabled. Defaults to False. |
False
|
|
str
|
Description of the widget. Defaults to "". |
''
|
|
str
|
Reference for the widget. Defaults to "". |
''
|
|
bool
|
Whether to show the widget in the report. Defaults to True. |
True
|
|
str
|
Help text for the widget. Defaults to ''. |
''
|
Returns:
| Type | Description |
|---|---|
None | FileData | List[FileData]
|
None | FileData | List[FileData]: The uploaded file(s). If no file is uploaded, returns None. If a single file is uploaded (is_multiple=False), returns a FileData object. If multiple files are uploaded (is_multiple=True), returns a list of FileData objects. |
multiselect
staticmethod
¶
multiselect(key, options, value=None, label='', disabled=False, description='', reference='', show=True, help_text='', helper_images=None)
Create a multiselect widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Unique identifier for the widget. |
required |
|
List[str] | List[NumericValueT]
|
List of options for the multiselect. |
required |
|
Optional[List[str] | List[NumericValueT]]
|
Default selected values. Defaults to None. |
None
|
|
str
|
Label for the widget. Defaults to "". |
''
|
|
bool
|
Whether the widget is disabled. Defaults to False. |
False
|
|
str
|
Description of the widget. Defaults to "". |
''
|
|
str
|
Reference for the widget. Defaults to "". |
''
|
|
bool
|
Whether to show the widget in the report. Defaults to True. |
True
|
|
str
|
Help text for the widget. Defaults to ''. |
''
|
|
Optional[List[WidgetHelperImage]]
|
List of helper images for the widget. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
List[str] | List[NumericValueT]
|
List[str] | List[NumericValueT]: The selected values. |
number_input
staticmethod
¶
number_input(key, min_val, max_val, step, label='', value=None, disabled=False, description='', reference='', unit='', format_str='{:.2f}', show=True, help_text='', helper_images=None)
Create a number input widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Unique identifier for the widget. |
required |
|
NumericValueT
|
Minimum value allowed. |
required |
|
NumericValueT
|
Maximum value allowed. |
required |
|
NumericValueT
|
Step size for the input. |
required |
|
str
|
Label for the widget. Defaults to "". |
''
|
|
Optional[NumericValueT]
|
Default value. Defaults to None. |
None
|
|
bool
|
Whether the widget is disabled. Defaults to False. |
False
|
|
str
|
Description of the widget. Defaults to "". |
''
|
|
str
|
Reference for the widget. Defaults to "". |
''
|
|
str
|
Unit of the value. Defaults to "". |
''
|
|
str
|
Format string for the value. Defaults to '{:.2f}'. |
'{:.2f}'
|
|
bool
|
Whether to show the widget. Defaults to True. |
True
|
|
str
|
Help text for the widget. Defaults to ''. |
''
|
|
Optional[List[WidgetHelperImage]]
|
List of helper images for the widget. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
NumericValueT |
NumericValueT
|
The value of the widget. |
selectbox
staticmethod
¶
selectbox(key, options, value=None, label='', disabled=False, description='', reference='', show=True, help_text='', helper_images=None)
Create a selectbox widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Unique identifier for the widget. |
required |
|
List[str] | List[NumericValueT]
|
List of options for the selectbox. |
required |
|
Optional[str | NumericValueT]
|
Default selected value. Defaults to None. |
None
|
|
str
|
Label for the widget. Defaults to "". |
''
|
|
bool
|
Whether the widget is disabled. Defaults to False. |
False
|
|
str
|
Description of the widget. Defaults to "". |
''
|
|
str
|
Reference for the widget. Defaults to "". |
''
|
|
bool
|
Whether to show the widget in the report. Defaults to True. |
True
|
|
str
|
Help text for the widget. Defaults to ''. |
''
|
|
Optional[List[WidgetHelperImage]]
|
List of helper images for the widget. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
str | NumericValueT
|
str | NumericValueT: The selected value. |
slider
staticmethod
¶
slider(key, min_val, max_val, step, label='', value=None, disabled=False, description='', reference='', unit='', format_str='{:.2f}', show=True, help_text='', helper_images=None)
Create a slider widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Unique identifier for the widget. |
required |
|
NumericValueT
|
Minimum value allowed. |
required |
|
NumericValueT
|
Maximum value allowed. |
required |
|
NumericValueT
|
Step size for the slider. |
required |
|
str
|
Label for the widget. Defaults to "". |
''
|
|
Optional[NumericValueT]
|
Default value. Defaults to None. |
None
|
|
bool
|
Whether the widget is disabled. Defaults to False. |
False
|
|
str
|
Description of the widget. Defaults to "". |
''
|
|
str
|
Reference for the widget. Defaults to "". |
''
|
|
str
|
Unit of the value. Defaults to "". |
''
|
|
str
|
Format string for the value. Defaults to '{:.2f}'. |
'{:.2f}'
|
|
bool
|
Whether to show the widget. Defaults to True. |
True
|
|
str
|
Help text for the widget. Defaults to ''. |
''
|
|
Optional[List[WidgetHelperImage]]
|
List of helper images for the widget. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
NumericValueT |
NumericValueT
|
The value of the widget. |
table_input
staticmethod
¶
table_input(key, col_formats, label='', min_rows=1, max_rows=100, is_file=False, value=None, disabled=False, description='', reference='', show=True, help_text='')
Create a table input widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Unique identifier for the widget. |
required |
|
List[ColumnFormatBase]
|
List of column formats for the table. |
required |
|
str
|
Label for the widget. Defaults to "". |
''
|
|
int
|
Minimum number of rows allowed. Defaults to 1. |
1
|
|
int
|
Maximum number of rows allowed. Defaults to 100. |
100
|
|
bool
|
Whether the input is a file. Defaults to False. |
False
|
|
Optional[List[List]]
|
Default value. Defaults to None. |
None
|
|
bool
|
Whether the widget is disabled. Defaults to False. |
False
|
|
str
|
Description of the widget. Defaults to "". |
''
|
|
str
|
Reference for the widget. Defaults to "". |
''
|
|
bool
|
Whether to show the widget in the report. Defaults to True. |
True
|
|
str
|
Help text for the widget. Defaults to ''. |
''
|
Returns:
| Type | Description |
|---|---|
List[List]
|
List[List]: The value of the table input. |
text_input
staticmethod
¶
text_input(key, label='', max_chars=100, max_rows=1, value=None, disabled=False, description='', reference='', show=True, help_text='', helper_images=None)
Create a text input widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Unique identifier for the widget. |
required |
|
str
|
Label for the widget. Defaults to "". |
''
|
|
int
|
Maximum number of characters allowed. Defaults to 100. |
100
|
|
int
|
Maximum number of rows allowed. Defaults to 1. |
1
|
|
Optional[str]
|
Default value. Defaults to None. |
None
|
|
bool
|
Whether the widget is disabled. Defaults to False. |
False
|
|
str
|
Description of the widget. Defaults to "". |
''
|
|
str
|
Reference for the widget. Defaults to "". |
''
|
|
bool
|
Whether to show the widget in the report. Defaults to True. |
True
|
|
str
|
Help text for the widget. Defaults to ''. |
''
|
|
Optional[List[WidgetHelperImage]]
|
List of helper images for the widget. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: The value of the text input. |