petercour
Posted on June 17, 2019
You can use Python on the web, instead of Javascript.
Yes, really.
There's a project named Brython: "A Python 3 implementation for client-side web programming".
So how does it work:
Step 1: Include Brython
<script type="text/javascript" src="/src/brython.js"></script>
Step 2: Write your code, say
<body onload="brython(1)">
<script type="text/python">
from browser import document, alert
def echo(ev):
alert("Hello {} !".format(document["zone"].value))
document["test"].bind("click", echo)
</script>
<p>Your name is : <input id="zone" autocomplete="off">
<button id="test">clic !</button>
</body>
Step 3: Demo https://brython.info/gallery/hello.html
More resources,
Learn python and demos
💖 💪 🙅 🚩
petercour
Posted on June 17, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.