-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb.py
30 lines (22 loc) · 763 Bytes
/
web.py
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
import streamlit as st
import functions
todos = functions.get_todos()
def add_todo():
todo = st.session_state["new_todo"] + "\n"
todos.append(todo)
functions.write_todos(todos)
st.session_state["new_todo"] = ""
todos = functions.get_todos()
st.title("My Todo App")
st.subheader("This is my todo app.")
st.write("This app is to increase your productivity.")
for index, todo in enumerate(todos):
checkbox = st.checkbox(todo, key=todo)
if checkbox:
todos.pop(index)
functions.write_todos(todos)
del st.session_state[todo]
st.experimental_rerun()
st.text_input(label="input_todo", label_visibility="hidden",
placeholder="Add new todo...",
on_change=add_todo, key="new_todo")