estem
December 11, 2024, 12:14pm
1
Hi,
with st.container(key="btn-container-test"):
continueBtn =st.form_submit_button("login", type="primary")
if continueBtn:
custom_function1()
some code
custom_function2()
what I’m looking for is to set a progressbar when i click continueBtn btn, and the progressbar should end at the same time of the code inside the continueBtn btn.
could you help please ?
Goyo
December 11, 2024, 1:56pm
2
Just create the bar at the beginning, then add calls to bar.progress() in the places where you know the progress.
continueBtn = st.button("login", type="primary")
if continueBtn:
bar = st.progress(0.0, text="Progress")
custom_function1()
bar.progress(1 / 3)
some code
bar.progress(2 / 3)
custom_function2()
bar.progress(1.0)
1 Like
estem
December 11, 2024, 2:15pm
3
thanks for your time , is there a way please to display the percentage ?
Goyo
December 11, 2024, 2:50pm
4
Use the text argument to display whatever text you want.
continueBtn = st.button("login", type="primary")
if continueBtn:
bar = st.progress(0.0, text=f"{0.0}%")
custom_function1()
bar.progress(1 / 3, text=f"{100 / 3}%")
some code
bar.progress(2 / 3, text=f"{200 / 3}%")
custom_function2()
bar.progress(1.0, text=f"{100.0}%")
system
Closed
December 13, 2024, 2:50pm
5
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.