i have streamlitcodewindow, [code] when i am using this window [code] but even after…
- User
i have streamlit_code_window,
codedef st_code_window(title, code): # Initialize session state for the editor if 'show_editor' not in st.session_state: st.session_state.show_editor = False if 'code' not in st.session_state: st.session_state.code = code # Use a form to control the editor with st.form('editor_form', clear_on_submit=False, border=False): markdown_section, edit_section = st.columns([0.7, 0.3], gap='large', vertical_alignment='top') markdown_section.markdown(f'### {title}\n') # Editor and Code View Toggle if st.session_state.show_editor: with edit_section: toggle_button = st_form_button('💾 Save') # Use the Ace editor updated_code = st_ace( value=st.session_state.code, language='python', theme='github', keybinding='vscode', min_lines=20, max_lines=None, font_size=14, tab_size=4, wrap=False, show_gutter=True, show_print_margin=True, auto_update=True, ) # Update the session state code with the new content if updated_code != st.session_state.code: st.session_state.code = updated_code # Save button behavior if toggle_button: st.session_state.show_editor = False st.rerun() else: with edit_section: toggle_button = st_form_button('✏️ Edit') st.code(st.session_state.code, language='python') if toggle_button: st.session_state.show_editor = True st.rerun() return st.session_state.codewhen i am using this window
codecode = stc.st_code_window(title='Generated test cases', code=st.session_state.app.pytest_codes) - Assistant
- User
yeah, now the code is getting updated but for editing using the edit button the code and while saving the code it's showing previous code ie, without edits
- Assistant