Forgive me if this has been covered already, but I couldn’t find this exact issue, either because it’s not there or my search abilities are lacking. In any event, whenever I load a page, the code in the <py-script>
tag displays on screen while pyodide is downloading (which, by the way, seems to download on every refresh). Here’s an example:
Here’s the HTML. What am I missing?
<!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">
<title>Shakespearean Insults!</title>
<!-- PyScript import -->
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
<style>
h1 {
text-align: center;
}
</style>
</head>
<body>
<br><br><br><br><br>
<h1 id="main"></h1>
<py-script>
import random
adjectives = """bankrupt base caterwauling corrupt cullionly detestable dishonest false filthsome filthy foolish foul gross heedless indistinguishable infected insatiate irksome lascivious lecherous loathsome lubbery old peevish rascaly rotten ruinous scurilous scurvy slanderous sodden-witted thin-faced toad-spotted unmannered vile wall-eyed""".split()
nouns = """Judas Satan ape ass barbermonger beggar block boy braggart butt carbuncle coward coxcomb cur dandy degenerate fiend fishmonger fool gull harpy jack jolthead knave liar lunatic maw milksop minion ratcatcher recreant rogue scold slave swine traitor varlet villain worm""".split()
adj = ", ".join(random.choices(adjectives, k=2))
noun = random.choice(nouns)
display = f"You {adj} {noun}!"
Element("main").write(display)
</py-script>
</body>
</html>