Thank your for replying @Marisa_Smith …You inspired me to try again
As for the previous post’s code. If you remove the ‘fake’ delay the results vary a lot depending on machine load. This is obviously a bad solution to the problem:)
Streamlit version 85.0 (earlier had same problem)
Using on desktop with no optimization at all
I did get the following snippet to work (So Far…) but it is very Kludgy and doesn’t inspire confidence.
NOTE: the placement of the Spinner and the time length are important or it wont work. See comments below)
I can upload the original and klugy fix videos if you still want to see…
# Display Each chart and header
def show_charts(coin, coin_period_dict):
print_chart_header(coin, "1d")
st.plotly_chart(get_candlestick_figure(coin_period_dict['df_1d'], coin), use_container_width=True) # Plot 1 day chart
print_chart_header(coin, "16h")
st.plotly_chart(get_candlestick_figure(coin_period_dict['df_16h'], coin), use_container_width=True) # Plot 16h
print_chart_header(coin, "12h")
st.plotly_chart(get_candlestick_figure(coin_period_dict['df_12h'], coin), use_container_width=True) # Plot 12h
print_chart_header(coin, "8h")
st.plotly_chart(get_candlestick_figure(coin_period_dict['df_8h'], coin), use_container_width=True) # Plot 8h
print_chart_header(coin, "4h")
st.plotly_chart(get_candlestick_figure(coin_period_dict['df_4h'], coin), use_container_width=True) # Plot 4h
print_chart_header(coin, "2h")
st.plotly_chart(get_candlestick_figure(coin_period_dict['df_2h'], coin), use_container_width=True) # Plot 30m
print_chart_header(coin, "1h")
st.plotly_chart(get_candlestick_figure(coin_period_dict['df_1h'], coin), use_container_width=True) # Plot 15m
print_chart_header(coin, "30m")
st.plotly_chart(get_candlestick_figure(coin_period_dict['df_30m'], coin), use_container_width=True) # Plot 30m
print_chart_header(coin, "15m")
st.plotly_chart(get_candlestick_figure(coin_period_dict['df_15m'], coin), use_container_width=True) # Plot 15m
# ------------------------ Begin Display Page Layout ----------------------------------------
components.html("<center><h1 style = color:white> Market Scan </h1></center>", height=70)
with st.form("hello"):
coin = st.session_state.current_coin # Get name of current coin to print
coin_period_dict = st.session_state.next_coin_data # Get preloaded dictionary of coin data
# with st.spinner("Loading..."):
# time.sleep(0.2)
here = st.empty()
with st.spinner("Loading..."): # This must be HERE and not above 'here = ...' line above
time.sleep(0.2) # Less that 0.2 fails
with here.beta_container():
show_charts(coin, coin_period_dict) # Display each chart in order
st.form_submit_button("Next", on_click=test, args=("hello", "world"))
# ------------------------ End Display Page Layout ----------------------------------------