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