Multiple checkboxes exist together

how to realize the function that several checkboxes are put in a row, when I select one, the below display the result

Do you have a sample code to experiment with?

for i in range(5):
    num = st.checkbox(f'{i}')
    if num:
        st.markdown(f'this is {i}')

like this ,but I hope the checkboxes in a row

Try the column widget if this suits your requirements.

cols = st.columns(5)

for i in range(5):
    with cols[i]:
        num = st.checkbox(f'{i}')
        if num:
            st.markdown(f'this is {i}')

Output

image

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