1
0
mirror of https://github.com/pyscript/pyscript.git synced 2022-05-01 19:47:48 +03:00

simplify example

This commit is contained in:
Fabio Pliger
2022-04-20 18:16:43 -05:00
parent 019b7d145a
commit 40c58c3cf1

View File

@@ -2,7 +2,6 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Todo App</title> <title>Todo App</title>
@@ -14,12 +13,12 @@
- paths: - paths:
- /utils.py - /utils.py
</py-env> </py-env>
<py-register-widget src="/pylist.py" name="py-list" klass="PyList"></py-widget> <py-register-widget src="/pylist.py" name="py-list" klass="PyList"></py-register-widget>
</head> </head>
<body> <body>
<py-title>To Do List</py-title> <py-title>To Do List</py-title>
<py-box widths="2/3;1/3"> <py-box widths="4/5;1/5">
<py-inputbox id="new-task-content"> <py-inputbox id="new-task-content">
def on_keypress(e): def on_keypress(e):
if (e.code == "Enter"): if (e.code == "Enter"):
@@ -27,12 +26,10 @@
</py-inputbox> </py-inputbox>
<py-button id="new-task-btn" label="Add Task!"> <py-button id="new-task-btn" label="Add Task!">
def on_click(evt): def on_click(evt):
task = { "content": new_task_content.value, "done": False, "created_at": dt.now() } add_task()
myList.add(PyItem(task, labels=['content'], state_key="done"))
new_task_content.clear()
</button> </button>
</py-box> </py-box>
<py-list id="myList"></py-list> <py-list id="myList"></py-list>
<py-repl id="my-repl" auto-generate="true"> </py-repl> <py-repl id="my-repl" auto-generate="true"> </py-repl>
</body> </body>