Is it possible to block the selection of the same option in a two-way slider?
My code:
slider = st.slider(‘Select a time period :’, 1992, 2022, (1992, 2022), 1)
Is it possible to block the selection of the same option in a two-way slider?
My code:
slider = st.slider(‘Select a time period :’, 1992, 2022, (1992, 2022), 1)
I don’t see any way to do this natively, so you have to manually verify a user’s input and the override it if they tried to select a range of size zero.
I checked GitHub issues and I did not see this as feature request yet. I think this would be a lovely feature request to add: allow setting a “minimum” size (and maybe even a maximum size) for a ranged slider. In a simple case the minimum size might be 1 to simply prevent the start and end from being the same, but more abstractly I could see a usefulness to natively restrict the kind of range that could be selected. Feel free to put in a feature request if it’s something that interests you: Sign in to GitHub · GitHub
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
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.