allow_none=True for typical widgets?

widgets always coerce the value to a default. this sometimes leads to unwanted behaviour in user input forms when the user selects nothing but the widget always returns a default value.


import ipywidgets as widgets
# 0

in traitlets you can allow_none for a given value… is there a way to do this for widgets (e.g. widgets.IntText)

ipywidgets is based on traitlets, did you try disabled?
disabled = Bool(False, help="Enable or disable user changes").tag(sync=True)
But maybe you can create a subclass from IntText and then you can set allow_none=True