Pytml

Pytml is a 15KB lightweight PyScript alternative — run Python in HTML with one script tag.

git clone https://github.com/notamitgamer/Pytml.git
· rebuilt hourlyOpen on GitHub
root / examples / greeting.html

greeting.html (783B)


      1 <!DOCTYPE html>
      2 <html lang="en">
      3 <head>
      4   <meta charset="UTF-8">
      5   <meta name="viewport" content="width=device-width, initial-scale=1.0">
      6   <title>Pytml Greeting</title>
      7   <script src="https://pytml.vercel.app/pytml.js"></script>
      8   <style>
      9     body { font-family: system-ui; padding: 30px; max-width: 560px; margin: auto; }
     10     input { padding: 12px; width: 220px; }
     11     button { padding: 12px 18px; margin-left: 6px; cursor: pointer; }
     12     #result { margin-top: 20px; font-size: 24px; }
     13   </style>
     14 </head>
     15 <body>
     16 <h1>Greeting</h1>
     17 
     18 <py1>
     19 
     20 <input1>Type your name</input1>
     21 <btn1>Say hello</btn1>
     22 
     23 
     24 def greet(e):
     25     result.html = "Hello, " + input1.value + "!"
     26 
     27 
     28 btn1.on("click", greet)
     29 
     30 </py1>
     31 
     32 <p id="result"></p>
     33 <p><a href="../demo.html">← Back to demos</a></p>
     34 </body>
     35 </html>