mirror of
https://github.com/pyscript/pyscript.git
synced 2022-05-01 19:47:48 +03:00
Added SPA for Freedom Units.
This commit is contained in:
@@ -42,6 +42,9 @@
|
|||||||
WARNING: This examples takes a little longer to load. So be patient :)
|
WARNING: This examples takes a little longer to load. So be patient :)
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<h2 class="text-2xl font-bold text-blue-600"><a href="./toga/freedom.html" target=”_blank”>Freedom Units!</a></h2>
|
||||||
|
<p>A Toga application (a Fahrenheit to Celsius converter), rendered as a Single Page App</p>
|
||||||
|
|
||||||
<h2 class="text-2xl font-bold text-blue-600"><a href="./d3.html" target=”_blank”>Simple d3 visualization</a></h2>
|
<h2 class="text-2xl font-bold text-blue-600"><a href="./d3.html" target=”_blank”>Simple d3 visualization</a></h2>
|
||||||
<p>Minimal d3 demo demonstrating how to create a visualization</p>
|
<p>Minimal d3 demo demonstrating how to create a visualization</p>
|
||||||
|
|
||||||
|
|||||||
57
pyscriptjs/examples/toga/freedom.html
Normal file
57
pyscriptjs/examples/toga/freedom.html
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<link rel="icon" type="image/png" href="./static/logo-32.png"/>
|
||||||
|
|
||||||
|
<!-- Bootstrap CSS -->
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
|
||||||
|
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
|
||||||
|
crossorigin="anonymous">
|
||||||
|
<link rel="stylesheet" href="./static/toga.css">
|
||||||
|
|
||||||
|
<script defer src="../build/pyscript.js"></script>
|
||||||
|
|
||||||
|
<title>Loading...</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="toga-placeholder">Loading...</div>
|
||||||
|
|
||||||
|
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
|
||||||
|
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
|
||||||
|
crossorigin="anonymous">
|
||||||
|
</script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
||||||
|
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
||||||
|
crossorigin="anonymous">
|
||||||
|
</script>
|
||||||
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
|
||||||
|
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
|
||||||
|
crossorigin="anonymous">
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
<py-script>
|
||||||
|
import asyncio
|
||||||
|
import micropip
|
||||||
|
|
||||||
|
await micropip.install([
|
||||||
|
'./static/wheels/travertino-0.1.3-py3-none-any.whl',
|
||||||
|
'./static/wheels/toga_core-0.3.0.dev33-py3-none-any.whl',
|
||||||
|
'./static/wheels/toga_web-0.3.0.dev33-py3-none-any.whl',
|
||||||
|
'./static/wheels/freedom-0.0.1-py3-none-any.whl',
|
||||||
|
])
|
||||||
|
|
||||||
|
from toga_web.dom import handle as dom_handle
|
||||||
|
from toga import platform
|
||||||
|
|
||||||
|
platform.current_platform = 'web'
|
||||||
|
|
||||||
|
from freedom.__main__ import main
|
||||||
|
|
||||||
|
app = main().main_loop(spa=True)
|
||||||
|
|
||||||
|
</py-script>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user