Skip to content

Instantly share code, notes, and snippets.

@KenoLeon
Last active May 4, 2022 00:33
Show Gist options
  • Select an option

  • Save KenoLeon/24027e9bd398b19a5760984fa723e2a9 to your computer and use it in GitHub Desktop.

Select an option

Save KenoLeon/24027e9bd398b19a5760984fa723e2a9 to your computer and use it in GitHub Desktop.
PyScript to DOM writing example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<title>PyScript to DOM</title>
</head>
<body>
<py-script>
import random as rd
pyscript.write('randomGoesHere', rd.random())
</py-script>
<br>
<div class="alert alert-info mx-auto" id="randomGoesHere" role="alert" style="width: 400px;">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment