Skip to content

Commit 84642df

Browse files
authored
Add files via upload
1 parent f0d960b commit 84642df

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

PWUI.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#from streamlit_extras.jupyterlite import jupyterlite
1717

1818

19-
version = "1.50"
19+
version = "1.51"
2020

2121
st.set_page_config(
2222
page_title="Parrot OCE",
@@ -31,6 +31,16 @@
3131
}
3232
)
3333

34+
caches = ['codes']
35+
for i in caches:
36+
if i not in st.session_state:
37+
st.session_state[i] = False
38+
39+
if not st.session_state['codes']:
40+
st.session_state['codes'] = '''texts = ["hello POCE!", "I love python3.10!"]
41+
for i in texts:
42+
print(i)'''
43+
3444
st.title("Parrot OCE")
3545
st.caption(f'''Parrot Online Code Environment: v{version}
3646
Python:{sys.version}
@@ -174,11 +184,9 @@ def translat(text):
174184

175185
col1, col2 = st.columns([0.7,0.3])
176186
with col1:
177-
codes = st_ace(language='python',theme='chaos',height=500, font_size=col2.number_input("字体大小", 16, 24, 16),auto_update=True,value='''texts = ["hello POCE!", "I love python3.10!"]
178-
for i in texts:
179-
print(i)''')
187+
codes = st_ace(language='python',theme='chaos',height=500, font_size=col2.number_input("字体大小", 16, 24, 16),auto_update=True,value=st.session_state['codes'])
180188
#jupyterlite(600, 1600)
181-
189+
st.session_state['codes'] = codes
182190
# Display editor's content as you type
183191
#st.text_area(":material/code: Python代码块",height=400,value='''print("hello POCE!")
184192
#print("I love python3.10!")''')

0 commit comments

Comments
 (0)