Add 1 files
Browse files
app.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import numpy as np
|
3 |
+
|
4 |
+
st.title("Todo List")
|
5 |
+
|
6 |
+
def add_task():
|
7 |
+
task = st.text_input('Add a new task:')
|
8 |
+
if st.button('Add'):
|
9 |
+
if task:
|
10 |
+
tasks.append(task)
|
11 |
+
return st.write('Tasks:', tasks)
|
12 |
+
|
13 |
+
def check_task():
|
14 |
+
task = st.selectbox('Select a task to check:', tasks)
|
15 |
+
if st.button('Check'):
|
16 |
+
tasks.remove(task)
|
17 |
+
checked.append(task)
|
18 |
+
return st.write('Checked:', checked)
|
19 |
+
|
20 |
+
def reset_task():
|
21 |
+
st.button('Reset').click(reset_tasks)
|
22 |
+
|
23 |
+
def reset_tasks():
|
24 |
+
tasks[:] = []
|
25 |
+
checked[:] = []
|
26 |
+
|
27 |
+
tasks = []
|
28 |
+
checked = []
|
29 |
+
|
30 |
+
add_task()
|
31 |
+
|
32 |
+
if st.checkbox('Check', checked):
|
33 |
+
check_task()
|
34 |
+
|
35 |
+
reset_task()
|