### Install Streamlit Bokeh Events using Pip Source: https://github.com/christophna/streamlit-bokeh3-events/blob/main/README_ash2shukla.md This command installs the streamlit-bokeh-events package using pip. It's a prerequisite for using the component in your Streamlit applications. ```bash pip install streamlit-bokeh-events ``` -------------------------------- ### Install Streamlit Bokeh3 Events using Pip Source: https://github.com/christophna/streamlit-bokeh3-events/blob/main/README.md Installs the streamlit-bokeh3-events package, which is necessary for integrating Bokeh 3 plots with Streamlit applications. This command ensures all dependencies are managed automatically. ```bash pip install streamlit-bokeh3-events ``` -------------------------------- ### Python Usage of Streamlit Bokeh Events with Bokeh Plot Source: https://github.com/christophna/streamlit-bokeh3-events/blob/main/README_ash2shukla.md This Python code demonstrates how to integrate a Bokeh plot within a Streamlit application using the streamlit-bokeh-events component. It shows how to define custom JavaScript events on a Bokeh plot and capture their details within Streamlit. Dependencies include Streamlit and Bokeh. ```python import streamlit as st from bokeh.plotting import figure from bokeh.models import ColumnDataSource, CustomJS # import function from streamlit_bokeh_events import streamlit_bokeh_events # create plot p = figure(tools="lasso_select") cds = ColumnDataSource( data={ "x": [1, 2, 3, 4], "y": [4, 5, 6, 7], } ) p.circle("x", "y", source=cds) # define events cds.selected.js_on_change( "indices", CustomJS( args=dict(source=cds), code=''' document.dispatchEvent( new CustomEvent("YOUR_EVENT_NAME", {detail: {your_data: "goes-here"}}) ) ''' ) ) # result will be a dict of {event_name: event.detail} # events by default is "", in case of more than one events pass it as a comma separated values # event1,event2 # debounce is in ms # refresh_on_update should be set to False only if we dont want to update datasource at runtime # override_height overrides the viewport height result = streamlit_bokeh_events( bokeh_plot=p, events="YOUR_EVENT_NAME", key="foo", refresh_on_update=False, override_height=600, debounce_time=500) # use the result st.write(result) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.