-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtester.py
29 lines (23 loc) · 876 Bytes
/
tester.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import streamlit as st
# List of options
options = ["A", "B", "C", "D"]
# Initialize session state to track the selected items
if "selected" not in st.session_state:
st.session_state.selected = []
# Function to determine available options based on selection
def get_available_options(selected):
if "D" in selected:
# If "D" is selected, disable "A", "B", and "C"
return [option for option in options if option == "D"]
else:
return options
# Get the available options based on the current selection
available_options = get_available_options(st.session_state.selected)
# Display multiselect widget with dynamic options
st.session_state.selected = st.multiselect(
"Select your options:",
available_options,
default=st.session_state.selected
)
# Display the selected items
st.write("You selected:", st.session_state.selected)