Thanks for a great platform. I’m trying to create an app that allows the user to build a series of objects, basically as many as they want. I create a button to allow them to add another. However to my great surprise the button works to add a second item, and then toggles back to one rather than adding a third. Here is a MWE
import streamlit as st class Builder: def __init__(self): st.header('Build tuple') self.button = st.empty() def build_multiple(self, multiple=(), level=0): single = self.build_one() if self.button.button('Build another', level): multiple = (single,) + self.build_multiple(multiple,level=level+1) return multiple def build_one(self): st.subheader('Building one') # Logic to build my items return "Hello" builder = Builder() items = builder.build_multiple() print(items)
What is going on here? Thanks in advance.