Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
user:hof:pyeditor [2024-02-28 18:37] – [First try: bottom.ch] hofuser:hof:pyeditor [2025-08-22 07:13] (aktuell) – [WebtigerPython iframe] hof
Zeile 1: Zeile 1:
-First try: bottom.ch +Inline Python Editors 
-With iframe on bottom.ch/ksr/py/embed.html, which is based on pyodide and codemirror.+ 
 +## Bottom.ch with direct component 
 +This is the preferred version as of 2025.
  
 <code html> <code html>
-<html><iframe frameborder="0" width="100%" allow="clipboard-write" src="https://tkilla77.github.io/python_editor_wasm/embed.html?autorun&code=print%28%27Hello%2C+dokuwiki%21%27%29"></iframe></html></code>+<!-- Include the script once (or from a DokuWiki plugin, or from userscripts. --> 
 +<html><script type="module" src="https://bottom.ch/ksr/ed/bottom-editor.js"></script></html>
  
-<html><iframe frameborder="0" width="100%" allow="clipboard-write" src="https://tkilla77.github.io/python_editor_wasm/embed.html?autorun&code=print%28%27Hello%2C+dokuwiki%21%27%29"></iframe></html>+<!-- Include a custom component in HTML. Use height, min-height, max-height to control the size. --> 
 +<!-- Leading empty lines will be dropped. --> 
 +<html><bottom-editor style="min-height10lh;autorun> 
 +print(42) 
 +</bottom-editor></html
 +</code>
  
 +<html><script type="module" src="https://bottom.ch/ksr/ed/bottom-editor.js"></script></html>
  
-Second try: JupyterLite+<html><bottom-editor style="min-height: 10lh;" autorun>print(42)</bottom-editor></html> 
 + 
 +You can install files from an URL (with CORS headers if from a different domain!): 
 + 
 +<code html> 
 +<html><bottom-editor zip='https://bottom.ch/ksr/py/files/2m.zip'> 
 +with open('gemeinden.csv', 'r') as infile: 
 +    for line in infile: 
 +        tokens = line.split(','
 +        town = tokens[0] 
 +        if town == 'Romanshorn': 
 +            print(f'Romanshorn hat {tokens[2]} Einwohner'
 +</bottom-editor></html> 
 +</code> 
 + 
 +<html><bottom-editor zip='https://bottom.ch/ksr/py/files/2m.zip'> 
 +with open('gemeinden.csv', 'r') as infile: 
 +    for line in infile: 
 +        tokens = line.split(','
 +        town = tokens[0] 
 +        if town == 'Romanshorn': 
 +            print(f'Romanshorn hat {tokens[2]} Einwohner'
 +</bottom-editor></html> 
 +## WebtigerPython iframe 
 + 
 +  * [[https://docs.webtigerpython.ethz.ch/iframe.html#|Dokumentation iframe]] 
 +  * [[https://docs.webtigerpython.ethz.ch/url-arguments.html|Dokumentation URL-Parameter]] 
 + 
 +<code html> 
 +<html><iframe src="https://webtigerpython.ethz.ch/?layout=%5B%7B%22type%22%3A%20%22Editor%22%7D%2C%7B%22type%22%3A%20%5B%22Canvas%22%2C%22Console%22%5D%7D%5D&lang=de&full_screen=false&dark_mode=false&device=-&code=NobwRAdghgtgpmAXGGUCWEB0AHAnmAGjABMoAXKJMAMwCcB7GAAjIFdayAbOJtGbehyYAqADoRxdNGQBeTALxMAKuy5wAFAEpJtaTMzVBAdyi1i6gKwAGbRCmzM3amXUBOGzr0Hjp89dv2%2Bk4u7gG6Doa0JmaWHnbhQXDObnGB3lG%2BsWFewSm2YAC%2BALpAA%3D" allow="usb;clipboard-write" style="border: 1px solid lightgray; height: 500px; width: 100%"> 
 +</iframe> 
 +</html></code> 
 + 
 +<html><iframe src="https://webtigerpython.ethz.ch/?layout=%5B%7B%22type%22%3A%20%22Editor%22%7D%2C%7B%22type%22%3A%20%5B%22Canvas%22%2C%22Console%22%5D%7D%5D&lang=de&full_screen=false&dark_mode=false&device=-&code=NobwRAdghgtgpmAXGGUCWEB0AHAnmAGjABMoAXKJMAMwCcB7GAAjIFdayAbOJtGbehyYAqADoRxdNGQBeTALxMAKuy5wAFAEpJtaTMzVBAdyi1i6gKwAGbRCmzM3amXUBOGzr0Hjp89dv2%2Bk4u7gG6Doa0JmaWHnbhQXDObnGB3lG%2BsWFewSm2YAC%2BALpAA%3D" allow="usb;clipboard-write" style="height: 500px; width: 100%; border: 1px solid lightgray;"> 
 +</iframe> 
 +</html> 
 + 
 +## Bottom.ch with iframe 
 +With iframe on bottom.ch/ksr/py/embed.html, which is based on pyodide and codemirror. 
 + 
 +<code html> 
 +<html><iframe frameborder="0" width="100%" allow="clipboard-write" src="https://tkilla77.github.io/python_editor_wasm/embed_old.html?autorun&code=print%28%27Hello%2C+dokuwiki%21%27%29"></iframe></html></code> 
 + 
 +<html><iframe frameborder="0" width="100%" allow="clipboard-write" src="https://tkilla77.github.io/python_editor_wasm/embed_old.html?autorun&code=print%28%27Hello%2C+dokuwiki%21%27%29"></iframe></html> 
 + 
 +## JupyterLite
  
 Also based on pyodide, but with jupyter support all around. Also based on pyodide, but with jupyter support all around.
  
-<html><iframe+<code html><iframe 
 +  src="https://jupyterlite.github.io/demo/repl/index.html" 
 +  width="100%" 
 +  height="500px"></iframe></code> 
 +   
 +   
 +<HTML><iframe
   src="https://jupyterlite.github.io/demo/repl/index.html"   src="https://jupyterlite.github.io/demo/repl/index.html"
   width="100%"   width="100%"
-  height="500px"></iframe></html>+  height="500px"></iframe></HTML>
  • user/hof/pyeditor.1709145463.txt.gz
  • Zuletzt geändert: 2024-02-28 18:37
  • von hof