-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext-editor.py
More file actions
29 lines (23 loc) · 863 Bytes
/
text-editor.py
File metadata and controls
29 lines (23 loc) · 863 Bytes
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
import streamlit as st
def main():
st.title("Text Editor")
# Set size of input box
st.markdown("""<style>
.css-2trqyj {
width: 500px !important;
height: 100px !important;
}
</style>""", unsafe_allow_html=True)
# Create text editor
text = st.text_area("Enter your text here", height=500)
# Add your advanced features here
# For example:
# 1. Word count
words = text.split()
st.write(f"Word count: {len(words)}")
# 2. Download file button
if st.button("Download File"):
download_link = f'<a href="data:text/plain;charset=utf-8,{text}" download="text_editor_content.txt">Download File</a>'
st.markdown(download_link, unsafe_allow_html=True)
if __name__ == "__main__":
main()