-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.py
26 lines (19 loc) · 630 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
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.title("To-Do App")
st.subheader("This is my To-Do 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.rerun()
st.text_input(label="", placeholder="Add new to-do...", on_change=add_todo, key='new_todo')
st.session_state