Skip to content
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

Question - Can i use ipywidgets without a notebook #877

Closed
DonJayamanne opened this issue Nov 4, 2016 · 7 comments
Closed

Question - Can i use ipywidgets without a notebook #877

DonJayamanne opened this issue Nov 4, 2016 · 7 comments
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Milestone

Comments

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Nov 4, 2016

Can I use the Jupyter_client api to execute code against a kernel and still use ipywidgets?

Currently when I do this, I get the following response from the Kernel:

Widget Javascript not detected. It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"

Note: The widgetsnbextension is already enabled.

jupyter nbextension enable --py --sys-prefix widgetsnbextension
Enabling notebook extension jupyter-js-widgets/extension...
      - Validating: OK
@SylvainCorlay
Copy link
Member

SylvainCorlay commented Nov 4, 2016

It is possible to embed widgets in a webpage, just like what you can see here:

http://jupyter.org/widgets

The equivalent with a connected back end is not supported yet.

@DonJayamanne
Copy link
Contributor Author

DonJayamanne commented Nov 4, 2016

@SylvainCorlay
When you say "It is possible to embed widgets in a webpage"
Don't you mean notebook instead of webpage

@SylvainCorlay
Copy link
Member

SylvainCorlay commented Nov 4, 2016

No I mean that you can embed widgets in your blog or personal website, just like on the jupyter.org website.

@DonJayamanne
Copy link
Contributor Author

@SylvainCorlay
How's that done? Is that just some hardcoded JavaScript (markup in the webpage) or is the following Python code (executed on the server) to generate the javascript?

from ipyleaflet import Map
Map(center=[34.6252978589571, -77.34580993652344], zoom=10)

Looking at the examples, they are executed in notebooks (which in turn generate javascript rendered on the webpage).

The widgets to my knowledge is basically a bunch of javascript code + data generated by the Python code executed. So, where is this python code being executed?

@SylvainCorlay
Copy link
Member

You author your widgets / visualization from the notebook. Then in the menu Widgets -> Embed Widgets will give you a copy-pastable snippet of HTML code.

@jasongrout
Copy link
Member

Looking at the examples, they are executed in notebooks (which in turn generate javascript rendered on the webpage).

The javascript is loaded independently, it's not generated by the python. The state of the widgets is communicated back and forth with python. You can embed the javascript + initial state (which provides some interaction that is entirely in javascript). Check out the examples in the jupyter-js-widgets repo, or use the 'Embed Widgets' feature Sylvain mentioned above.

You can also have javascript that starts up a kernel on a python server somewhere and communicates with it, embedding the widgets from that. See the web3 example for this.

@jasongrout
Copy link
Member

Closing as answered - please reopen if you have more questions or want to continue the discussion.

@jasongrout jasongrout modified the milestone: 6.0 Mar 1, 2017
@github-actions github-actions bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Feb 16, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

3 participants