Iโm struggling with way to create a fixed number of steps a user can take to use the App. Iโve landed on using st.empty()
and works up to first two steps, then resets back to beginning after trying to move to first step. Looking for suggestions! Thank you
def write():
shown_page = 'intro'
if shown_page == "intro":
contIntro = st.empty()
expIntro = contIntro.expander('What App Wizard Can Do', True)
job_name = expIntro.text("Give this Job a Name")
col1, col2 = expIntro.columns([9,1])
col1.write("")
exp1_button = col2.button('To Step 1')
if exp1_button:
contIntro.empty()
shown_page = 'Step 1'
if shown_page == 'Step 1':
header_text = 'Step 1'
cont1 = st.empty()
exp1 = cont1.expander('Step 1 of 2', True)
exp1.file_uploader('Upload Data', type=None, accept_multiple_files=False)
col1, col2 = exp1.columns([9,1])
col1.write("")
exp1_back_button = col1.button('Back to Intro')
exp1_next_button = col2.button('To Step 2')
if exp1_back_button:
cont1.empty()
shown_page = 'Intro'
if exp1_next_button:
cont1.empty()
shown_page = 'Step 2'
if shown_page == 'Step 2':
header_text = 'Step 2'
cont2 = st.empty()
exp2 = cont2.expander("Step 2 of 2", True)
job_name = exp2.text_input("Some more info")
col1, col2 = exp2.columns([9,1])
exp2_back_button = col1.button("Back to Step 1")
exp2_forward_button = col2.button('To Another Setp in Future')
if exp2_back_button:
upload_data.write()
if exp2_back_button:
cont2.empty()
shown_page = 'Step 2'
if exp2_forward_button:
cont2.empty()
Then moves to Step 1 when hit โTo Step 1โ
Then I hit โTo Step 2โ and it brings me back to Intro, when Iโd expect to move to Step 2