I am currently learning HoloViz and stumbled up on this Discourse Thread titled How to trigger on_click
event of the button widget?. How would one utilize the provided solution on that thread with Bokeh instead of utilizing MatplotLib
import panel as pn
pn.extension()
from random import randint
from panel import widgets as pnw
from matplotlib.figure import Figure
pbutton = pnw.Button(name='Click me', button_type='primary')
# plot = pn.pane.Matplotlib(name='plot') # REPLACE THIS WITH BOKEH
other_button = pnw.Button(name='Other button', button_type='warning')
def b(event):
# REPLACE WITH BOKEH
fig = Figure()
ax = fig.add_subplot()
# ------------------
ax.plot([randint(0,10) for i in range(10)])
plot.object = fig
pbutton.on_click(b)
def c(e):
pbutton.clicks += 1
other_button.on_click(c)
#pbutton.click() <--- I would put my trigger here
pbutton.clicks += 1
pn.Column(pbutton, plot, other_button).servable()