Hi! As the title says. When I select any value on Selectbox 1 ‘sb1’ the callback function associated to Selectbox 2 ‘sb2’ gets activated. Expected functionality is that function is executed ONLY when Selectbox 2 values change (Option 3 or Option 4 are chosen).
Am I doing something wrong or is this a known bug?
import streamlit as st
from datetime import datetime
def print_func(words):
now = datetime.now()
print(f'{now.minute}m{now.second}s - {words} changed')
sb1 = st.selectbox(
label='Selectbox 1',
options=['Option 1', 'Option 2'],
)
sb2 = st.selectbox(
label='Selectbox 2 - on_change callback',
options=['Option 3', 'Option 4'],
on_change=print_func('selectbox')
)```
Tested on Streamlit 1.30 and 1.31.1
Python 3.10