streamlit
streamlit copied to clipboard
Automatically generate user_key for widgets
Problem
Currently, widgets with exactly same parameters will get same widget id which cause error, for eg.
import streamlit as st
st.date_input("day")
st.date_input("day")
And user have to provide a key value to make it work.
Solution
In my code, I usually do this by:
import streamlit as st
key_gen = iter(range(10000))
st.date_input("day", key=next(key_gen))
st.date_input("day", key=next(key_gen))
So why streamlit not do this automatically?