Spaces:
Runtime error
Runtime error
File size: 1,054 Bytes
99f5743 b7524fd 9d642e3 de55d8c 9d642e3 418b498 9d642e3 418b498 9d642e3 418b498 9d642e3 418b498 9d642e3 418b498 9d642e3 418b498 9d642e3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import streamlit as st
# Create a list to hold messages
messages = []
# Define a function to handle form submissions
def handle_form_submit(form_data):
message = form_data["message"]
messages.append(message)
# Define the layout of the app
st.title("Scrollable Output and Submitable Form")
st.write("Enter a message below and click 'Submit' to add it to the output:")
# Add the input form
form = st.form(key="message_form")
message_input = form.text_input(label="Message:")
submit_button = form.form_submit_button(label="Submit", on_click=handle_form_submit, args=(form_data,))
st.write("")
# Add the output window
if len(messages) > 0:
st.write("Output:")
with st.beta_container():
for message in messages:
st.write("- " + message)
else:
st.write("No messages yet.")
"""import pexpect
import time
# Start the other program
child = pexpect.spawn("python DO_NOT_COMMIT.py", encoding='utf-8', timeout=None)
while True:
child.expect(">>>>>")
print(child.before)
child.sendline(input(">>>>>"))"""
|