I’m building a simple application and want to show or hide the contents of a container based on a flag in the session state. The main layout looks like this:
main = st.container() main.title(title) body = main.container() code_container = main.container() state = main.container()
There is a button which has a method to set the state. When I attempt to operate on that state in code, however, this error is thrown when I click the button.
with code_container: if st.session_state.showing_code is True: st.write("hi") else: st.empty()
What am I missing? Thanks for taking the time to consider this - really appreciate it.
Streamlit, version 1.10.0