St.spinner in st.tab

Maybe im doing it wrong but why cant I have a spinner inside of a tab?
No errors when using the following code, however the spinner is outside of the tab:

def ui_scatter(scatter_tab, envolope, test_points, hw_dict, test_type):
    '''
    Draw UI for scatter plot tab
    '''
    with st.spinner("Gererating Scatter Plot"):

However Changing the st.spinner to scatter_tab.spinner :

def ui_scatter(scatter_tab, envolope, test_points, hw_dict, test_type):
    '''
    Draw UI for scatter plot tab
    '''
    with scatter_tab.spinner("Gererating Scatter Plot"):

with scatter tab being

scatter_tab, line_tab, table_tab = data_tab.tabs(["Scatter", "Line", "Table"])

The error

StreamlitAPIExceptio: Method spinner() does not exist for DeltaGenerator objects. Did you mean st.spinner()?

Call st.spinner inside the with clause:

with scatter_tab:
    with st.spinner("Gererating Scatter Plot"):
        generate_scatter_plot()
1 Like