- Enter a key in text box, the App will run a query and return a list of options.
- For each option, display a checkbox and check it by default.
- The options from step 1 are likely to be the same among different runs but with small difference.
- I don’t want to use multiselect drop down here.
- If I uncheck a checkbox, the state will be memorized even if the checkbox is regenerated.
- Yes I tried to give the a unique id for each checkbox but it will keep resetting every checkbox.
A example code:
import streamlit as st import numpy as np def main(): case_id = st.text_input("Please enter an ID") if case_id: options = sorted(np.random.choice([1,2,3,4,5], 4, replace=False)) pathways_bool = [st.checkbox(str(_x),True) for _x in options] if __name__ == "__main__": main()
Thanks for your help!