I have a problem with navigation buttons. When I try to move to the next command
After clicking next button inside if statement , It keeps showing me the previous part.
And only after clicking again on the next button it does not show the previous part.
The goal is to move between texts and display only that text for each link
if st.session_state.count < len(st.session_state.papers):
st.write("Progress: ", st.session_state.count + 1 , "/", len(st.session_state.papers))
text = st.session_state.papers[st.session_state.count]["Description"]
link = st.session_state.papers[st.session_state.count]["Link"]
label = st.selectbox("Do you want to include this resource to your content?:", [None,"Yes","No"], index=None)
if st.button("Next ⏭️"):
if st.session_state.count + 1 > len(st.session_state.papers):
st.session_state.count = 0
st.session_state.count += 1
if label == "Yes":
if st.session_state.count > 0:
if st.button("⏮️ Previous"):
if st.session_state.label_list[-1] == "Yes":
st.session_state.count -= 1
Thank you for your help. I have one more question. Is it possible to add a “Yes or No” selectbox to it and select quotes with navigation buttons. After all the selections. Write only “Yes” ones together.
I want to make a selection among the given quotes. The user will navigate between the quotes with the navigation buttons and select “Yes” because they chose them through the select box, or “No” because they do not want them to remain. I want to record the answers of the users and when they submit their answers at the end, I want to print the quotes they choose one under the other. Think like it is a catalogue, by selecting the ones you like with the selectbox and viewing them with the next and previous buttons among the quotes.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
Hello there 👋🏻
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.