Problems with the new widget behaviour under streamlit 0.89.0

Hello everyone,
I have some problems in understanding the new widget behavior of streamlit 0.89.0. Here is a short example:

import streamlit as st

if "checkbox1" not in st.session_state:
    st.session_state.checkbox1=True
def on_checkbox_change(changed_checkbox_number):
    if changed_checkbox_number==1:
        st.session_state.checkbox2=False
    elif changed_checkbox_number==2:
        st.session_state.checkbox1=False
st.checkbox(label='Checkbox1',key='checkbox1',on_change=on_checkbox_change,args=(1,))
st.checkbox(label='Checkbox2',key='checkbox2',on_change=on_checkbox_change,args=(2,))

On streamlit 0.88.0 this example works well. If you click on one of the two checkboxes the other one is deactivated. But in 0.89.0 it doesn’t work. If you click on one of the checkboxes the other one remains activated in the UI. What is the correct way in streamlit 0.89.0 for implementing such a widget interaction?

1 Like

Thanks for reporting this @kospe.

It indeed looks like a bug. We’ve reported the issue to the Devs who will investigate.

I’ll keep you posted here :slight_smile:

Best,
Charly

I investigated this and it is indeed a bug, so I opened this github issue for it, and hopefully we’ll get a fix merged in for the next release.

2 Likes

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