Dear Boss
My code is functioning correctly within this application. I have two st.expander components, and I would like to retrieve the checkbox titles from the second st.expander, which is labeled ‘Excluded’. Please provide me with the correct code to obtain all the checkbox titles from the second expander.
My Code
import streamlit as st
import pandas as pd
def initialize():
if ‘df’ not in st.session_state:
data = {}
for i in range(20):
col = f’col{i}’
data[col]= range(10)
st.write(‘initializing’)
df = pd.DataFrame(data)
st.session_state.df = df
st.session_state.columns = list(df.columns)initialize()
df = st.session_state.df
columns = st.session_state.columns
def move_column(col, state):
if state:
st.session_state[col] = True
st.session_state.columns.remove(col)
else:
st.session_state[col] = False
st.session_state.columns.append(col)configure = st.columns(2)
with configure[0]:
included = st.expander(‘Included’, expanded=True)
with included:
st.write(‘’)
with configure[1]:excluded = st.expander(‘Excluded’, expanded=True)
with excluded:
st.write(‘’)for col in df.columns:
if col in st.session_state.columns:
with included:
st.checkbox(col,key=col, value=False, on_change=move_column, args=(col,True))
else:
with excluded:
st.checkbox(col, key=col, value=True, on_change=move_column, args=(col,False))
st.write(col)
df[columns]
st.markdown(‘’'[data-testid=“stExpander”] ul [data-testid=“stVerticalBlock”]{overflow-y:scroll; max-height:400px;} ‘’', unsafe_allow_html=True)
thank you in advance for your help
regard