[IPython-dev] More widget feasibility ideas
nick.bollweg at gmail.com
Thu Oct 30 13:05:10 EDT 2014
You specify it when you create the instance:
w = SomeWidget(_dom_classes=["panel-body"])
or, in the case of class that should always get a _dom_class:
def __init__(self, *args, **kwargs):
super(PanelBody, self).__init__(*args, **kwargs)
self._dom_classes += ("panel-body",)
You could also monkey with the kwargs beforehand, avoiding, under the
covers, two calls to update_classes, but this approach is easy to read,
which i think wins out.
When I asked about this on gitter, the reasoning for this change was that
the add/remove class couldn't be made stateful, and that it was using
extra, custom comms stuff to do something that traitlets were perfectly
capable of. Thus, this traitlet. Howevever, as you can see from it having
the _ prefix, this is really much more of a widget-developer functionality:
not exactly simple.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev