Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8c8b641

Browse files
authored
Merge pull requestpyscript#37 from anaconda/quickfix/move_code_out_pylist
move code from pylist.py to the example directly
2 parents0b5004f +08aadbe commit8c8b641

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

‎pyscriptjs/examples/pylist.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,3 @@ def on_click(self, evt=None):
99

1010
classPyList(PyListTemplate):
1111
item_class=PyItem
12-
13-
defadd_task(*ags,**kws):
14-
# create a new dictionary representing the new task
15-
task= {"content":new_task_content.value,"done":False,"created_at":dt.now() }
16-
17-
# add a new task to the list and tell it to use the `content` key to show in the UI
18-
# and to use the key `done` to sync the task status with a checkbox element in the UI
19-
myList.add(task,labels=['content'],state_key="done")
20-
21-
# clear the inputbox element used to create the new task
22-
new_task_content.clear()

‎pyscriptjs/examples/todo-pylist.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@
1414
- /utils.py
1515
</py-env>
1616
<py-register-widgetsrc="/pylist.py"name="py-list"klass="PyList"></py-register-widget>
17+
18+
<py-script>
19+
def add_task(*ags, **kws):
20+
# create a new dictionary representing the new task
21+
task = { "content": new_task_content.value, "done": False, "created_at": dt.now() }
22+
23+
# add a new task to the list and tell it to use the `content` key to show in the UI
24+
# and to use the key `done` to sync the task status with a checkbox element in the UI
25+
myList.add(task, labels=['content'], state_key="done")
26+
27+
# clear the inputbox element used to create the new task
28+
new_task_content.clear()
29+
30+
</py-script>
1731
</head>
1832

1933
<body>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp