File tree Expand file tree Collapse file tree 4 files changed +29
-9
lines changed Expand file tree Collapse file tree 4 files changed +29
-9
lines changed Original file line number Diff line number Diff line change 70
70
71
71
You can see this application embedded into the page below:
72
72
73
- <iframe src =" https://ntoll.pyscriptapps.com/piratical/v3 " style =" border : 1px solid black ; width :100% ;min-height : 400px ; border-radius : 0.2rem ; box-shadow : var (--md-shadow-z1 );" ></iframe >
73
+ <iframe src =" https://ntoll.pyscriptapps.com/piratical/v4/ " style =" border : 1px solid black ; width :100% ;min-height : 400px ; border-radius : 0.2rem ; box-shadow : var (--md-shadow-z1 );" ></iframe >
74
74
75
75
Let's explore each of the three files that make this app work.
76
76
Original file line number Diff line number Diff line change @@ -178,10 +178,11 @@ use of inline event handlers via custom HTML attributes.
178
178
of why this is currently considered bad practice.
179
179
180
180
These attributes are expressed as ` py-* ` attributes of an HTML element that
181
- reference the name of a Python function to run when the event is fired. The
182
- ` * ` is replaced by the name of event, in a similar fashion to how all
181
+ reference the name of a Python function to run when the event is fired. You
182
+ should replace the ` * ` with the _ actual name of an event_ (e.g. ` py-click ` ).
183
+ This is similar to how all
183
184
[ event handlers on elements] ( https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers-on-elements,-document-objects,-and-window-objects )
184
- start with ` on ` (e.g. ` onclick ` ) in standard HTML . The rule of thumb is to
185
+ start with ` on ` in standard HTML (e.g. ` onclick ` ). The rule of thumb is to
185
186
simply replace ` on ` with ` py- ` and then reference the name of a Python
186
187
function.
187
188
@@ -210,5 +211,5 @@ enable this behaviour.
210
211
manipulation of the attribute's value could have resulted in the evaluation
211
212
of arbitrary code.
212
213
213
- This is why we changed to the current behaviour of just supplying the name
214
- of the Python function to be evaluated.
214
+ This is why we changed to the current behaviour: just supply the name
215
+ of the Python function to be evaluated, and PyScript will do this safely .
Original file line number Diff line number Diff line change @@ -61,8 +61,8 @@ The outcome of these code fragments should look something like this:
61
61
62
62
Hovering over the Python editor reveals the "run" button.
63
63
64
- Finally, it is possible to specify a target node into which the output from
65
- ` print ` statements is directed :
64
+ Finally, the ` target ` attribute allows you to specify a node into which the
65
+ editor will be rendered :
66
66
67
67
``` html title="Specify a target for the Python editor."
68
68
<script type =" mpy-editor" target =" editor" >
Original file line number Diff line number Diff line change 1
1
# Example applications
2
2
3
- ** TODO: fill this with references and descriptions to examples on PyScript.com **
3
+ A curated list of example applications that demonstrate various features of
4
+ PyScript can be found [ on PyScript.com] ( https://pyscript.com/@examples ) .
5
+
6
+ The examples are (links take you to the code):
7
+
8
+ * [ Hello world] ( https://pyscript.com/@examples/hello-world/latest )
9
+ * [ A simple clock] ( https://pyscript.com/@examples/simple-clock/latest )
10
+ * [ Simple slider panel] ( https://pyscript.com/@examples/simple-panel/latest )
11
+ * [ Streaming data panel] ( https://pyscript.com/@examples/streaming-in-panel/latest )
12
+ * [ WebGL Icosahedron] ( https://pyscript.com/@examples/webgl-icosahedron/latest )
13
+ * [ KMeans in a panel] ( https://pyscript.com/@examples/kmeans-in-panel/latest )
14
+ * [ New York Taxi panel (WebGL)] ( https://pyscript.com/@examples/nyc-taxi-panel-deckgl/latest )
15
+ * [ Pandas dataframe fun] ( https://pyscript.com/@examples/pandas/latest )
16
+ * [ Matplotlib example] ( https://pyscript.com/@examples/matplotlib/latest )
17
+ * [ Numpy fractals] ( https://pyscript.com/@examples/fractals-with-numpy-and-canvas/latest )
18
+ * [ Folium geographical data] ( https://pyscript.com/@examples/folium/latest )
19
+ * [ Bokeh data plotting] ( https://pyscript.com/@examples/bokeh/latest )
20
+ * [ Import antigravity] ( https://pyscript.com/@examples/antigravity/latest )
21
+ * [ Altair data plotting] ( https://pyscript.com/@examples/altair/latest )
22
+
You can’t perform that action at this time.
0 commit comments