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

Commit6ec94a0

Browse files
committed
Added SPA for Freedom Units.
1 parent8fdc28e commit6ec94a0

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

‎pyscriptjs/examples/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ <h2 class="text-2xl font-bold text-blue-600"><a href="./panel.html" target=”_b
4242
WARNING: This examples takes a little longer to load. So be patient :)
4343
</p>
4444

45+
<h2class="text-2xl font-bold text-blue-600"><ahref="./toga/freedom.html"target=”_blank”>Freedom Units!</a></h2>
46+
<p>A Toga application (a Fahrenheit to Celsius converter), rendered as a Single Page App</p>
47+
4548
<h2class="text-2xl font-bold text-blue-600"><ahref="./d3.html"target=”_blank”>Simple d3 visualization</a></h2>
4649
<p>Minimal d3 demo demonstrating how to create a visualization</p>
4750

‎pyscriptjs/examples/toga/freedom.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!doctype html>
2+
<htmllang="en">
3+
<head>
4+
<metacharset="utf-8">
5+
<metaname="viewport"content="width=device-width, initial-scale=1, shrink-to-fit=no">
6+
<linkrel="icon"type="image/png"href="./static/logo-32.png"/>
7+
8+
<!-- Bootstrap CSS -->
9+
<linkrel="stylesheet"
10+
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
11+
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
12+
crossorigin="anonymous">
13+
<linkrel="stylesheet"href="./static/toga.css">
14+
15+
<scriptdefersrc="../build/pyscript.js"></script>
16+
17+
<title>Loading...</title>
18+
</head>
19+
<body>
20+
<divid="toga-placeholder">Loading...</div>
21+
22+
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
23+
<scriptsrc="https://code.jquery.com/jquery-3.5.1.slim.min.js"
24+
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
25+
crossorigin="anonymous">
26+
</script>
27+
<scriptsrc="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
28+
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
29+
crossorigin="anonymous">
30+
</script>
31+
<scriptsrc="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
32+
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
33+
crossorigin="anonymous">
34+
</script>
35+
</body>
36+
<py-script>
37+
import asyncio
38+
import micropip
39+
40+
await micropip.install([
41+
'./static/wheels/travertino-0.1.3-py3-none-any.whl',
42+
'./static/wheels/toga_core-0.3.0.dev33-py3-none-any.whl',
43+
'./static/wheels/toga_web-0.3.0.dev33-py3-none-any.whl',
44+
'./static/wheels/freedom-0.0.1-py3-none-any.whl',
45+
])
46+
47+
from toga_web.dom import handle as dom_handle
48+
from toga import platform
49+
50+
platform.current_platform = 'web'
51+
52+
from freedom.__main__ import main
53+
54+
app = main().main_loop(spa=True)
55+
56+
</py-script>
57+
</html>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp