DatetimeRangePicker#
Download this notebook from GitHub (right-click to download).
import datetime
import panel as pn
pn.extension()
The DatetimeRangePicker
widget allows selecting selecting a datetime value using a text box and the browser’s datetime-picking utility.
For more information about listening to widget events and laying out widgets refer to the widgets user guide. Alternatively you can learn how to build GUIs by declaring parameters independently of any specific widgets in the param user guide. To express interactivity entirely using Javascript without the need for a Python server take a look at the links user guide.
Parameters:#
For layout and styling related parameters see the customization user guide.
Core#
value
(tuple): Tuple of upper and lower bounds of the selected range expressed as datetime typesstart
(date or datetime): Inclusive lower bound of the allowed date selection.end
(date or datetime): Inclusive upper bound of the allowed date selection.disabled_dates
(list): Dates to make unavailable for selection; others will be availableenabled_dates
(list): Dates to make available for selection; others will be unavailableenable_time:
(boolean): Enable editing of the time in the widget, default is Trueenable_seconds:
(boolean): Enable editing of seconds in the widget, default is Truemilitary_time:
(boolean): Whether to display time in 24 hour format, default is True
Display#
disabled
(boolean): Whether the widget is editablevisible
(boolean): Whether the widget is visiblename
(str): The title of the widget
DatetimeRangePicker
uses a browser-dependent calendar widget to select the datetime:
values = (datetime.datetime(2021, 3, 2, 12, 10), datetime.datetime(2021, 3, 2, 12, 22))
datetime_range_picker = pn.widgets.DatetimeRangePicker(name='Datetime Range Picker', value=values)
datetime_range_picker
DatetimeRangePicker.value
returns a tuple of datetime values that can be read out and set like other widgets:
datetime_range_picker.value
(datetime.datetime(2021, 3, 2, 12, 10), datetime.datetime(2021, 3, 2, 12, 22))
Controls#
The DatetimeRangePicker
widget exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively:
pn.Row(datetime_range_picker.controls(jslink=True), datetime_range_picker)
Download this notebook from GitHub (right-click to download).