Popup disappear after 1 second in streamlit-folium app

Hello streamliters!

I would like to print some information in popups after a click event in a folium marker. Creating an app by following dynamic_updates.py example from streamlit-folium official repo I was able to do that. However, a weird behavior happens, when I click in the marker the popup shows and disappear after 1 second. Could someone help me to solve this problem? Any suggestion @randyzwitch?

Thanks in advance!
Wagner Wolff

Hi Wagner, welcome to our community! It’s great to have you here! :hugs:

Could you please provide a link to your code?

Best,
Charly

Hello @Charly_Wargnier thanks to kind reception! :slightly_smiling_face:

I used the example of official streamlit-folium documentation: dynamic_updates.py

I found a solution, I do not know if it is the better, but I replace the folium markers section by the following code:

for capital in capitals.itertuples():
            folium.Marker(
                location=[capital.latitude, capital.longitude],
                popup=f"{capital.capital}, {capital.state}",
                tooltip=f"{capital.capital}, {capital.state}",
                icon=folium.Icon(color="green")
                if capital.state == st.session_state["selected_state"]
                else None,
            ).add_to(m)

Seems to fix the error. However, the map is rerender.
Best
Wagner!

Nice workaround! Glad you found a fix! :hugs:

Best,
Charly

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.