PyDeck in Streamlit - event handling for on_click

582 Views Asked by At

Given the following code, the on_click event is not triggered, not certain why.

def on_click(info):
    print('Testing...')
    st.write("TEST TEST")

chart = pdk.Deck(
        map_style="dark",
        initial_view_state={
            "country": "CA",
            "latitude":45.458952,
            "longitude": -73.571648 ,
            "zoom": 11,
            "pitch": 50,
        },
        layers=[
            pdk.Layer(
                "HexagonLayer",
                data=df,
                #get_position=[-73.571648, 45.458952],
                get_position=['longitude', 'latitude'],
                auto_highlight=True,
                pickable=True,
                on_click=on_click,
                elevation=100,
                elevation_scale=9,
            ),
        ],
    )

st.pydeck_chart(chart)

The idea is to print out just for testing to see if the event triggers the on_click event, but nothing happens.

0

There are 0 best solutions below