Skip to content

Instantly share code, notes, and snippets.

@rafnixg
Created October 5, 2022 00:57
Show Gist options
  • Save rafnixg/d43c8eb5e4d7e38572251bf29e5610c3 to your computer and use it in GitHub Desktop.
Save rafnixg/d43c8eb5e4d7e38572251bf29e5610c3 to your computer and use it in GitHub Desktop.
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<body>
<button id="cf">Let's plot random numbers</button>
<form>
<input type="text" name="name" value="" id="name" disabled>
</form>
<py-script>
from js import document
contador = 0
input = Element('name')
name = input.value
def my_custome_function(e):
global name, input, contador
contador += 1
input.element.value = contador
button = Element('cf')
button.element.onclick = my_custome_function
</py-script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment