# Spinner

**URL:** <https://discuss.streamlit.io/t/spinner/70203>\
**Category:** Using Streamlit\
**Tags:** debugging\
**Created:** [May 20, 2024, 5:23pm UTC](https://discuss.streamlit.io/t/spinner/70203 "2024-05-20T17:23:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juliana\_Steinbach](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/juliana_steinbach/32/41597_2.png) [@Juliana\_Steinbach](https://discuss.streamlit.io/u/Juliana_Steinbach)\
**Post date:** [May 20, 2024, 5:23pm UTC](https://discuss.streamlit.io/t/spinner/70203/1 "2024-05-20T17:23:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Goyo](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/goyo/32/28219_2.png) [@Goyo](https://discuss.streamlit.io/u/Goyo)\
**Post date:** [May 20, 2024, 8:00pm UTC](https://discuss.streamlit.io/t/spinner/70203/2 "2024-05-20T20:00:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [November 16, 2024, 8:00pm UTC](https://discuss.streamlit.io/t/spinner/70203/3 "2024-11-16T20:00:12Z")

</div>

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