-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
43 lines (30 loc) · 1.02 KB
/
main.py
File metadata and controls
43 lines (30 loc) · 1.02 KB
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
43
import streamlit as st
from components.page import SideMenu
# Настройки окна браузера
st.set_page_config(
page_title="TODO списочек",
page_icon=":white_check_mark:",
layout="centered",
initial_sidebar_state="auto",
)
SideMenu()
# Описание странички
"""
## Мои развлечения с питоном
мини приложения на базе Streamlit фреймворка
---
"""
if "todos" not in st.session_state:
st.session_state['todos'] = []
else:
st.subheader('TODO list:', anchor='todo')
for item in st.session_state['todos']:
st.markdown("- " + item)
# Пример формы
with st.form("formTodo", clear_on_submit=True):
input = st.text_input(label="Добавить:", placeholder='Что надо сделать?')
submitted = st.form_submit_button("Добавить", type="primary")
if submitted and input:
# Заменит значение
st.session_state['todos'].append(input)
st.rerun()