""" This is a simple todo list app that allows you to add, remove, and mark tasks as complete. All actions are performed on the client side. """ import gradio as gr tasks = ["Get a job", "Marry rich", "", "", "", ""] textboxes = [] rows = [] with gr.Blocks() as demo: with gr.Row(): with gr.Column(scale=3): gr.Markdown("# A Simple Interactive Todo List") with gr.Column(scale=2): with gr.Row(): hide_button = gr.Button("Hide all tasks", variant="stop") show_button = gr.Button("Show all tasks") with gr.Column() as c: for i in range(6): with gr.Row() as r: t = gr.Textbox(tasks[i], placeholder="Enter a task", show_label=False, container=False, scale=7, interactive=True) b = gr.Button("✔️", interactive=bool(tasks[i]), variant="primary" if tasks[i] else "secondary") t.change(lambda : gr.Button(interactive=True, variant="primary"), None, b) b.click(lambda : gr.Row(visible=False), None, r) hide_button.click(lambda : gr.Column(visible=False), None, c) show_button.click(lambda : gr.Column(visible=True), None, c) # Add a button to add a new task demo.launch()