-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.py
More file actions
26 lines (19 loc) · 669 Bytes
/
Copy pathweb.py
File metadata and controls
26 lines (19 loc) · 669 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
import streamlit as st
import todo_functions
todos = todo_functions.get_todos()
def add_todo():
todo = st.session_state['new_todo'] + "\n"
todos.append(todo)
todo_functions.write_todos(todos)
todos = todo_functions.get_todos()
st.title("My Todo App")
st.subheader("This app is made to increase your productivity")
for index, todo in enumerate(todos):
checkbox = st.checkbox(todo, key=todo)
if checkbox:
todos.pop(index)
todo_functions.write_todos(todos)
del st.session_state[todo]
st.experimental_rerun()
st.text_input(label="", placeholder="Add new todo...",
on_change=add_todo, key='new_todo')