so i have a python file called main.py that i want to run when a button is pressed in a website i am creating but am unsure of how to go about this. i have looked at several different examples on the PyScript website but nothing seems to be what i want. is it possible and if so how would i do it?
html code:
<!DOCTYPE html>
<html>
<head>
<title>Secure Login</title>
<link rel="stylesheet"
href="style.css">
<link rel=”stylesheet” href=”htpps://pyscript.net/alpha/pyscript.css” />
<script defer
src=”htpps://pyscript.net/alpha/pyscript.js”>
</script>
</head>
<body>
<div class="main">
<h1>Secure Login</h1>
<h3>Enter your login credentials</h3>
<p>Not registered?
<a href="#"
style="text-decoration: none;">
Create an account
</a>
</p>
</div>
</body>
</html>
<script>
function runpython() {
<py-script src=”/my_own_file.py”>
</py-script>
}
</script>
<button onclick="runpython()">please work</button>
New contributor