Delete widgets

Hello all,

I am using streamlit to build a web app. I need to design an interactive web-app where I need to remove(delete) a set of widgets after a button click and replace them with new ones.

Please let me know if you find a solution. Thanks in advance.

PS: Using empty() or beta_containers did not solve my issue.

Maybe you can use python’s del operator. Will something like this work for you?

table_data = {'Column 1': [1, 2], 'Column 2': [3, 4]}

if st.button('delet dis'):
    del table_data
    st.write('mr button has delet for u')
    
try:
    st.write(pd.DataFrame(data=table_data))
except:
    pass


Thanks for creating the sandbox @sjd333! :smiley: It’s awesome to be able to try something out quickly in the browser! :clap: