
Hi
Many thanks for Bokeh!
I have successfully drawn a screen within a vscode notebook (using a Panel pane.Bokeh(column) where column is a Bokeh column). I have a python event handler there, which also works. It’s code is below, essentially every time the plot is tapped it generates an event and I do actually get the event!
However the screen does not refresh, so when I change data based on the tap - there is no change to the screen.
As you can see below, I tried several things, but they do not have the desired effect:
- I attempted to add a
change.emit, however theGlyphand theColumnDataSourcedo not have a change property. Is there some other place, accessible from within an event handler, where I can usechange.emit()? Or perhaps there is a new way to emit a redraw directive? - I tried to use Panel’s
pn.io.push_notebook(pane)but it simply has no effect. - I tried to use Panel’s
pane.param.trigger('object'), again to no effect
How do I get Bokeh to refresh the plot from inside the event handler? Thanks!
def tap_callback(event):
feature_index = floor(event.y)
feature_name = event.model.y_range.factors[feature_index]
new_value = ... # [details removed to avoid confusion]
# making the change show up in the plot
for r in event.model.renderers:
if hasattr(r, 'glyph'):
r.data_source.data['most important'][-1-feature_index] = new_value
if hasattr(r.data_source, 'change'):
print('here I am')
r.data_source.change.emit()
if hasattr(r.glyph, 'change'):
print('here I am')
r.glyph.change.emit()
print('will this work?')
self.pane.param.trigger('object')
pn.io.push_notebook(self.pane)
Versions:
Bokeh 3.1.1
vscode 1.79.2
Panel 1.1.1
jupyter_bokeh 3.0.7

