-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.py
More file actions
28 lines (21 loc) · 674 Bytes
/
web.py
File metadata and controls
28 lines (21 loc) · 674 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
27
28
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('My To-Do App')
st.subheader('This is my todo app')
st.write('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="Enter a todo: ", placeholder="To-Do",
on_change=add_todo, key='new_todo')
print("Page Refreshed")
st.session_state