Profile
Back to NewsBack
GitHub Trending 4 min
Reader Mode
brython-dev/brython: Brython (Browser Python) is an implementation of Python 3 running in the browser

brython-dev/brython: Brython (Browser Python) is an implementation of Python 3 running in the browser

15 hours ago

brython =======

Brython (Browser Python) is an implementation of Python 3 running in the browser, with an interface to the DOM elements and events.

Here is a simple example of an HTML page running Python:

<html>

<head> <script src="/path/to/brython.js"></script> </head>

<body>

<script type="text/python"> from browser import bind, document, alert

@bind(document['mybutton'], 'click') def echo(event): alert(document["zone"].value) </script>

<input id="zone"><button id="mybutton">click !</button>

</body>

</html>

To use Brython, all there is to do is:

  1. Load the script brython.js.
  2. Write Python code inside tags Chat with me