-
Notifications
You must be signed in to change notification settings - Fork 950
code to reproduce output from "Widgets -> Embed Widgets" #1654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Please see attach files for working (with "Widgets -> Embed Widgets") and non_working html |
The non-working example is missing some key properties in the widget state, namely the |
Is that intentional? |
uhm, I actually get the same error if trying sphinx-jupyter PR from jupyter/jupyter-sphinx#16 |
By the way, ipywidgets 7 is awesome and I love it much. ;) |
It is intentional (default is to get the data without default values). I'm considering whether it is the best, though. Usually these |
The defaults are only defined on the model, not the view. The defaults defined at https://github.com/arose/nglview/blob/master/js/src/widget_ngl.js#L27 should be moved up to the model at https://github.com/arose/nglview/blob/master/js/src/widget_ngl.js#L17 (That also explains why the javascript embedding worked - it also deleted any default values, but since you didn't define defaults for the view information, that was saved in the document.) |
Thanks! And thanks for testing things out! |
I am not sure what you meant here (due to my lack of understanding about how ipywidgets works). But below is a short chunk of codes: |
so, are you going to change it? If not yet, what's the idiom to make |
Move these three lines (https://github.com/arose/nglview/blob/master/js/src/widget_ngl.js#L32-L34) to here (https://github.com/arose/nglview/blob/master/js/src/widget_ngl.js#L22). Delete the defaults() function in the view. |
wow, work like a charm. Thanks Jason. (see the attached cc @arose Happy to close this issue. @jasongrout PS: May be updating docs if there is not yet. :) |
hi,
I am working embedding
nglview
. The "Widgets -> Embed Widgets" works nicely (I can see the render after open the html file).However, using the python API won't give the same expectation.
I guess I miss something here. Can you help? thanks
The text was updated successfully, but these errors were encountered: