Created
July 1, 2019 13:18
-
-
Save classmember/b3a8479d1dc240f7e3b05b3183cfc6ca to your computer and use it in GitHub Desktop.
Python in the browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.7.3/brython.min.js"> </script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.7.3/brython_stdlib.js"></script> | |
</head> | |
<body onload="brython()"> | |
<script type="text/python"> | |
from browser import document, alert | |
def echo(event): | |
alert(document["zone"].value) | |
document["mybutton"].bind("click", echo) | |
</script> | |
<input id="zone"><button id="mybutton">click !</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment