DateTimePicker
Introduction
DateTimePicker is a widget in Supervisely that allows you to choose a date and time on the UI.
Function signature
DateTimePicker(
value=None
readonly=False,
disabled=False,
editable=False,
clearable=True,
size=None,
placeholder="Select date and time",
w_type="datetime",
format="yyyy-MM-dd HH:mm:ss",
widget_id=None,
)
Parameters
value
Union[int, str, list, tuple, None]
Default value in DateTimePicker
readonly
bool
Allows to set read only mode
disabled
bool
Allows to disable DateTimePicker
editable
bool
Allows to edit input
clearable
bool
Shows clear button
size
Literal["large", "small", "mini", None]
Size of input field
placeholder
str
DateTimePicker placeholder
w_type
Literal["year", "month", "date", "datetime", "week", "datetimerange", "daterange"]
DateTimePicker picker type
format
Literal["yyyy", "MM", "dd", "HH", "mm", "ss"]
Datetime displaying format
widget_id
str
ID of the widget
value
Determine DateTimePicker default value.
type: Union[int, str, list, tuple, None]
default value: None

placeholder
Determine DateTimePicker placeholder.
type: str
default value: "Select date and time"

size
Determine DateTimePicker size of the input.
type: Literal["large", "small", "mini", None]
default value: None

w_type
Determine DateTimePicker picker type.
type: Literal["year", "month", "date", "datetime", "week", "datetimerange", "daterange"]
default value: "datetime"

format
Determine DateTimePicker displaying format.
type: Literal["yyyy", "MM", "dd", "HH", "mm", "ss"]
default value: "yyyy-MM-dd HH:mm:ss"

readonly
Determine whether DateTimePicker is read-only.
type: bool
default value: False

disabled
Determine whether DateTimePicker is disabled.
type: bool
default value: False

editable
Determine whether the input is editable.
type: bool
default value: False

clearable
Determine whether to show a clear button.
type: bool
default value: True

widget_id
The ID of the widget
type: str
default value: None
Methods and attributes
get_value()
Return DateTimePicker current value.
set_value(value: Union[int, str, datetime, list, tuple])
Set DateTimePicker value.
@value_changed
Decorator function to handle DateTimePicker click.
Mini App Example
You can find this example in our GitHub repository:
supervisely-ecosystem/ui-widgets-demos/input/006_datetime_picker/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Initialize DateTimePicker and Text widgets
DateTimePicker and Text widgetsCreate app layout
Prepare a layout for an app using Card widget with the content parameter.
Create an app using a layout
Create an app object with a layout parameter.
Add functions to control widgets from Python code

Last updated
Was this helpful?