0

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.

dirtyw0lf
  • 1,899
  • 5
  • 35
  • 63
  • Please share a more complete code example so we can try to reproduce the issue. In this case, df isn't defined, so I'm not able to run the code you've provided. – Caroline Frasca Jan 03 '23 at 20:28
  • For a full example you may consult the doc, and use the params I wrote for testing the onclick event : https://pydeck.gl/layer.html – dirtyw0lf Jan 04 '23 at 04:39

0 Answers0