good day guys. i have just started learning and practicing streamlit and i must say it is cool to use and simple. i have been making use of tkinter for basic desktop apps but now i intend learning streamlit to convert most of my tkinter apps to web app but the issue i am facing is that, some of the simple functions to get the values from input boxes on tkinter are not present on streamlit. stuffs like
insert to insert value into a text_area or text_input,
delete to clear the text_area or text_input box. i was thinking streamlit has such function maybe
box1 = st.text_area(âenter textâ)
box1.get() to get the value that is inside the box
box1.insert(âstringâ) to insert anything inside the text_area or text_input box. stuffs like this would be a great features to add to streamlit because it will make things easy to do with functions. i am currently having issues implementing such flow with streamlit. with tkinter, i have no issue doing this, but with streamlit, how do i get the value of a text_area, text_input when it is inserted after a function is being run. for example, check code below
import streamlit as st
import clipboard
import time
box2 = st.text_area("enter your age")
labels = [1, 2, 3, 4, 5]
box1 = st.text_area('Generated From function', value='type here')
box4 = st.empty()
def MAINFUNCTION(tojoin):
JOINLIST = "\n".join(str(i) for i in tojoin)
return JOINLIST
if st.button("Submit"):
runapp = MAINFUNCTION(labels)
with box4.beta_container():
st.text_area("Generated", runapp)
box1 = st.text_area("Generated From function", runapp)
box3 = st.text_area('enter your name', runapp)
#st.success(box1)
if st.button('copy'):
st.success(f'box1 to be copied: {box1}')
clipboard.copy(str(box1))
clipboard.paste()
st.success("copied successfully")
st.success(f'box4 to be copied: {box4}')
st.success(f'box1 to be copied: {box3}')
from the code above, i inserted the value from running the mainfunction after clicking the button. this works well and inserted the value. now i tried to copy the value from the box which was added when i run after clicking the button. but i got an error as nothing is being printed out and copied except this
box1 to be copied: type here
box4 to be copied: <streamlit.delta_generator.DeltaGenerator object at 0x0000021A28263CC8>
why is it not copying the actual content from the box instead of the above. how do i actually get the value inside a box regardless because if i remove the value and manually type anything in box1. it works but why doesnât it get the value that is generated from the function when the submit button is clicked since it was inserted automatically. also, even after clicking the copy button, the other text_area boxes disappears.
so my question is, how do i get the value regardless .