ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

Support continuous_update in DatePicker

Open nickpollari opened this issue 4 years ago • 1 comments
trafficstars

Currently the DatePicker widget will always trigger the callback as you type a date, it would be nice if this widget supported the continuous_update=False argument like other widgets do. This behavior is only problematic if the user is typing in a date (say editing the year from 2021 to 2025 using the keyboard). The problem does not surface if you set the value directly on the widget (only triggers callback once) or if the user clicks the GUI which displays the calendar and selects a date.

import ipywidgets
import datetime as dt

def cb(event):
    print(event)

# i wish this supported continuous_update but it triggers the callback every time
dp = ipywidgets.DatePicker(value=dt.datetime(2021,1,1), continuous_update=False)
dp.observe(cb, names=['value'])

nickpollari avatar Nov 11 '21 14:11 nickpollari