Create an app with a textarea at the top row, next row containing two buttons, one to the left and other to the right of the text area.
To upload files, please first save the app
import streamlit as st
st.title("Text Input with Buttons")
# Create a container for the layout
main_container = st.container()
# First row - Text area
with main_container:
text_input = st.text_area(
"Enter your text here",
height=200,
key="text_input",
placeholder="Type something..."
)
# Second row - Buttons
col1, col2 = st.columns(2)
with col1:
if st.button("Left Button", key="left_button"):
st.write(f"Left button clicked with text: {text_input}")
with col2:
if st.button("Right Button", key="right_button"):
st.write(f"Right button clicked with text: {text_input}")
# Display the current text
if text_input:
st.write("Current text:")
st.write(text_input)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?