Is there a way to change the placeholder text of a spinner?

I would like to change the placeholder text displayed when calling a function:

I tried using

with st.spinner(text="Fetching measures"):
        measures = fetch_measures(userid, start_ts, end_ts)

but it just adds a new warning above with “Fetching measures”. Is there a way to just change the text “Running function_name(…)”?

Hi vinzee,

I am not sure there is a beautiful solution to this, but you can disable the ‘original Running fetch_measures(…)’ by adding the show_spinner=False option on the cache decorator.

def fetch_measures(x,y,z):
    #do stuff

and then you can use your solution using with st.spinner(text="Fetching measures")


Hi PeterT and vinzee
Can you give me an example of your code?? I’m having trouble after running @st.cache(show_spinner=False)

Hi Jose,

I did it like this:

def fetch_measures():
    # do stuff

def main():
    with st.spinner(text="Fetching measures"):
        measures = fetch_measures()

if __name__ == "__main__":
1 Like