Buttons set their value to True
only in the instant they are clicked . After that, their value goes back to False
.
In your use case you would be advised to use st.radio
. Radio buttons lay out vertically, so that might not suit you. So, instead use st.checkbox
in multiple columns. Then set and hold the value state of the checkboxes in st.session_state
.
See “multi-page-app-with-session-state” for inspiration. If you want the page to reset, then use st.experimental_rerun
to run the app from the top but still preserving the set states.
HTH,
Arvindra