Hi
Many thanks for Panel!
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!
Versions:
Bokeh 3.1.1
vscode 1.79.2
Panel 1.1.1
jupyter_bokeh 3.0.7
The problem: 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 theGlyph
and theColumnDataSource
do not have a change property. Is it possible that the Panel pane “wrapper” has removed thechange
property? - 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 Panel 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('this line is never reached')
r.data_source.change.emit()
if hasattr(r.glyph, 'change'):
print('this line is never reached, either')
r.glyph.change.emit()
print('these two line do not seem to do what they should?')
self.pane.param.trigger('object')
pn.io.push_notebook(self.pane)
Many thanks
GPN