jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
951 stars 188 forks source link

Displaying 3D graphics on nbviewer #37

Closed ubuntuslave closed 6 years ago

ubuntuslave commented 8 years ago

The displayed output doesn't get rendered on Jupyter .ipynb notebooks on nbviewer

Has anyone achieved this with pythreejs?. The iPython notebook is supposed to be cached and showed as run last.

dustinmichels commented 6 years ago

On a similar note:

I'm really loving this library but I'm struggling to see how I can use it outside of a notebook. I would love to export a widget into a web page, perhaps within a Flask web app. Does anyone know how this can be done?

I tried using from ipywidgets.embed import embed_minimal_html, as documented here, but it seems that is only for basic widgets.

The jupyter widgets user guide has a section on embedding custom widget libraries, but I don't really understand it. It says:

The widget embedder attempts to fetch the model and view implementation of the custom widget from the npm CDN https://unpkg.com. The URL that is requested for, e.g. the bqplot module name, with the semver range ^2.0.0 is

https://unpkg.com/bqplot@^2.0.0/dist/index.js

which holds the webpack bundle for the bqplot library.

Any insights into rendering pythreejs widgets outside a notebook would be much appreciated!

vidartf commented 6 years ago

This should work with the latest release of pythreejs once https://github.com/jupyter-widgets/ipywidgets/pull/2026 (or another solution to the same problem) gets merged and released.

vidartf commented 6 years ago

This now works, see e.g. https://nbviewer.jupyter.org/github/jupyter-widgets/pythreejs/blob/master/examples/Textures.ipynb