I want to take multiple text inputs in a for loop. Using st.text_input() for that.
But the code does not wait for the input and it keeps on running even when the input is not passed.
I want to for next input till the user gives first one and presses enter.
Can you add a button to be clicked to start processing? Streamlit is not based on callbacks, and so using a button to explicitly start processing. This seems the cleanest way, to me.
Alternately, how do you know when the user is done providing input? Is there a specific phrase or a count of inputs before you consider it done? You can start processing also by checking for either of these cases?
This is a great point. How to solve this is both a function of how your code is set up and knowing when to process. Are both user inputs to the same function, or are you managing this some other way?
If I’m not mistaken, this thread and I want to take multiple inputs in a for loop are the same, so closing this one in lieu of the other one having some Python code snippets to try.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
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.
Performance cookies
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.
Functional cookies
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.
Targeting cookies
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.