Spinner

I am using spinner just to reinforce to the user that the calculation in my code is running, but if I set the spinner to 10 seconds, the program waits 10 seconds before starting the calculation, I thought that the rest of the code would be running while the spinner is spinning:

if data is not None and st.button("Compute result"):
    choice2=choice
else:
    st.stop()
with st.spinner('Wait for it...')
    time.sleep(10)
st.success('Done!')
agb.initProject('HySPI_scenarios')

… rest of the code

I also tried with:

for i in stqdm(range(50), backend=False, frontend=True):
    sleep(0.5)

same thing… what should I be doing instead? thanks

Put the calculation code inside the with st.spinner('Wait for it...'): statement.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.