Replies: 4 comments
-
I'm not sure I see the For example, you could make class AnyWidget(t.HasTraits):
_repr_mimebundle_ = MimeBundleDescriptor()
def on_msg(self, msg):
return NotImplemented
def send(self, contents, buffers):
... also, note that you can always add an alias for class AnyWidget:
_repr_mimebundle_ = MimeBundleDescriptor()
alias = _repr_mimebundle_
|
Beta Was this translation helpful? Give feedback.
-
Might also be worth exploring the |
Beta Was this translation helpful? Give feedback.
-
Switched over to |
Beta Was this translation helpful? Give feedback.
-
@tlambert03, dang I'm seeing the motivation for this only now. You had such foresight! ipywidgets is a huge dependency, and I'd like to experiment with a pure from anywidget.ipywidgets import AnyWidget and move ipywidgets towards an optional dependency, and then only expose a few APIs like I've been preferring the traitlets API since the Python side is consistent with connecting to existing ipywidgets, although I much prefer the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The
MimeBundeDescriptor
introduces a more library agnostic connection between python model and JS view, but currently doesn't support two important features fromipywidgets.Widget
. First a mechanism to both send and receive messages from the front end. The latter could be simple enough to implement with a special method (akin to_anywidget_get_state
):But I'm having trouble thinking of a way to allow for custom messages to be sent. Right now this can be accomplished with:
but I'd be ok with adding a
send
method toReprMimeBundle
directly (likesend_state
):Of course, using the
_repr_mimbundle_
name is a bit verbose, but I like how it makes it clear how these messages are only received if the front end is activated.Second, we should have a way of marking attributes which shouldn't automatically be synchronized with the frontend. This would be the opposite of
sync=True
for traitlets where by default everything is synchronized.Beta Was this translation helpful? Give feedback.
All reactions