Reputation: 3838
I am new dash and was wondering if there is a way to run dash on .ipynb files in vs-code. I found out that using JupyterDash
you're able to run dash on Jupyter IDE (The web version). I was wondering if there is a way to extend this to .ipynb files in vs-code (I heavily use vs-code Jupyter instead of the web version).
I tried making a radio button using this code within a cell in a .ipynb file in vs-code and it didn't work (Of course the same code did work in Jupyter web version). If there is way to run it in vscode, please do let me know.
from jupyter_plotly_dash import JupyterDash
import dash
import dash_core_components as dcc
import dash_html_components as HTML
from dash.dependencies import Input,Output
app = JupyterDash('SimpleExample')
app.layout = html.Div([
dcc.RadioItems(
id = 'dropdown-color',
options = [{'label' : c, 'value' : c.lower()} for c in ['Red','Green','Blue']],
value = 'red'
)
])
app
Upvotes: 1
Views: 4596
Reputation: 366
Follow the latest jupyter dash documents. Try this:
from jupyter_dash import JupyterDash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
app = JupyterDash('SimpleExample')
app.layout = html.Div([
dcc.RadioItems(
id = 'dropdown-color',
options = [{'label' : c, 'value' : c.lower()} for c in ['Red','Green','Blue']],
value = 'red'
)
])
# Run app and display result inline in the notebook
app.run_server(mode='inline')
More about it here:
https://medium.com/plotly/introducing-jupyterdash-811f1f57c02e
Upvotes: 1