Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,18 +4,27 @@ All actions are performed on the client side.
|
|
4 |
"""
|
5 |
import gradio as gr
|
6 |
|
7 |
-
tasks = ["Get a job", "Marry
|
8 |
textboxes = []
|
9 |
rows = []
|
10 |
|
11 |
with gr.Blocks() as demo:
|
12 |
-
gr.
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# Add a button to add a new task
|
21 |
|
|
|
4 |
"""
|
5 |
import gradio as gr
|
6 |
|
7 |
+
tasks = ["Get a job", "Marry rich", "", "", "", ""]
|
8 |
textboxes = []
|
9 |
rows = []
|
10 |
|
11 |
with gr.Blocks() as demo:
|
12 |
+
with gr.Row():
|
13 |
+
with gr.Column(scale=3):
|
14 |
+
gr.Markdown("# A Simple Interactive Todo List")
|
15 |
+
with gr.Column(scale=2):
|
16 |
+
with gr.Row():
|
17 |
+
hide_button = gr.Button("Hide all tasks", variant="stop")
|
18 |
+
show_button = gr.Button("Show all tasks")
|
19 |
+
with gr.Column() as c:
|
20 |
+
for i in range(6):
|
21 |
+
with gr.Row() as r:
|
22 |
+
t = gr.Textbox(tasks[i], placeholder="Enter a task", show_label=False, container=False, scale=7, interactive=True)
|
23 |
+
b = gr.Button("✔️", interactive=bool(tasks[i]), variant="primary" if tasks[i] else "secondary")
|
24 |
+
t.change(lambda : gr.Button(interactive=True, variant="primary"), None, b)
|
25 |
+
b.click(lambda : gr.Row(visible=False), None, r)
|
26 |
+
hide_button.click(lambda : gr.Column(visible=False), None, c)
|
27 |
+
show_button.click(lambda : gr.Column(visible=True), None, c)
|
28 |
|
29 |
# Add a button to add a new task
|
30 |
|