|
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() |