File size: 610 Bytes
18ec731 |
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 29 30 31 32 33 34 35 |
import streamlit as st
import numpy as np
st.title("Todo List")
def add_task():
task = st.text_input('Add a new task:')
if st.button('Add'):
if task:
tasks.append(task)
return st.write('Tasks:', tasks)
def check_task():
task = st.selectbox('Select a task to check:', tasks)
if st.button('Check'):
tasks.remove(task)
checked.append(task)
return st.write('Checked:', checked)
def reset_task():
st.button('Reset').click(reset_tasks)
def reset_tasks():
tasks[:] = []
checked[:] = []
tasks = []
checked = []
add_task()
if st.checkbox('Check', checked):
check_task()
reset_task() |