Hello team,
Do we have any way to disable & enable button or streamlit controllers? I have to disable a button after click & enable the same button after click of 2nd button.
Hello team,
Do we have any way to disable & enable button or streamlit controllers? I have to disable a button after click & enable the same button after click of 2nd button.
Hi @deepankar27 -
What user experience are you trying to develop here? Meaning, why does the button have to be disabled…does it cause a recalculation that you don’t want?
Hello @randyzwitch I want to force users to provide feedback on inference & then again repeat the step. Else users are skipping the feedback step.
Step1 :
Step 2:
import streamlit as st
import st_state_patch
def main():
st.title("Data Categorization")
txt = st.text_area("Paste your data here..")
s = st.State()
if not s:
s.pressed_first_button = False
if st.button("Find Category") or s.pressed_first_button:
s.pressed_first_button = True # preserve the info that you hit a button between runs
try:
if txt != '':
value = st.selectbox("Agree with result", ["Yes, I agree..", "Nah!! I don't"])
if st.button("Submit report"):
if value == "Yes, I agree..":
st.write('Do this ...')
elif value != "Nah!! I don't agree":
st.write('Do that ...')
else:
st.write('No content found')
except:
st.write('Looks like I am having problem connecting my backend')
if __name__ == '__main__':
main()
Hello @randyzwitch can you plz suggest anything on this?
I can’t promise anything @deepankar27, as this is a pretty specific question that I’d have to sit down and try myself. It feels like you could conditionally remove the button, but I’d have to think about it
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.