bokeh/ipywidgets_bokeh

Using nglview ipywidget

Jhsmit opened this issue · 1 comments

I'd like to use the nglview widget in a bokeh application.

I'm using bokeh 2.0.2 (bokeh channel) and ipywidgets 1.0.0 (bokeh channel)

from bokeh.plotting import curdoc
from bokeh.layouts import column

from ipywidgets_bokeh import IPyWidget
import nglview

view = nglview.show_pdbid("3pqr")
wrapper = IPyWidget(widget=view, width=800, height=800)

layout = column(wrapper)

doc = curdoc()
doc.add_root(layout)

If i run this with bokeh serve I get the following error in the browser console:

TypeError: "buffers is undefined"
    widgets 2.7.5/dist/index.js:116602
    _handleCommMsg http://localhost:5006/static/extensions/ipywidgets_bokeh/ipywidgets_bokeh.js:69
    _handleMessage http://localhost:5006/static/extensions/ipywidgets_bokeh/ipywidgets_bokeh.js:69

See also holoviz/panel#1307

Seems like an issue with nglview I don't think the msg spec requires there to be a buffers attribute so it should not assume there is one here:

https://github.com/nglviewer/nglview/blob/master/js/src/widget_ngl.ts#L156