diff --git a/examples/index.html b/examples/index.html index e0806f5f..46bc7a12 100644 --- a/examples/index.html +++ b/examples/index.html @@ -152,7 +152,7 @@

Demo showing how a Simple WebGL - scene would work in PyScript tag + scene would work in the <py-script> tag

diff --git a/examples/micrograd_ai.html b/examples/micrograd_ai.html index 98bba1d9..56baa161 100644 --- a/examples/micrograd_ai.html +++ b/examples/micrograd_ai.html @@ -43,21 +43,17 @@ classify the data.

- Currently the > symbol is being imported incorrectly as &gt; into the REPL's. + Currently the > symbol is being imported incorrectly as &gt; into the REPL's. In this app the > symbol has been replaced with ().__gt__() so you can run the code without issue. Ex: instead of a > b, you will see (a).__gt__(b) instead.

-

- import js; js.document.getElementById('python-status').innerHTML = 'Python is now ready. You may proceed.' -

Python is currently starting. Please wait...
-

-

-
- -


-
-

-

+ import js; js.document.getElementById('python-status').innerHTML = 'Python is now ready. You may proceed.' +
Python is currently starting. Please wait...
+
+ +

+
+

import random diff --git a/examples/numpy_canvas_fractals.html b/examples/numpy_canvas_fractals.html index b9916b37..dc7d4340 100644 --- a/examples/numpy_canvas_fractals.html +++ b/examples/numpy_canvas_fractals.html @@ -334,8 +334,8 @@ async def main(): ) asyncio.ensure_future(main()) - + + - diff --git a/examples/pandas.html b/examples/pandas.html index d3a910ce..d6bd723e 100644 --- a/examples/pandas.html +++ b/examples/pandas.html @@ -1,120 +1,120 @@ - - - - - - - - - - - - - - - - -
-
- -
-

Data Source

- - -
- - - - - - - - - - plugins = [ - "../build/plugins/python/py_tutor.py" - ] - packages = ["pandas"] - - -
- - import pandas as pd - from pyodide.http import open_url - import sys - - title = "Pandas (and basic DOM manipulation)" - page_message = "This example loads a remote CSV file into a Pandas dataframe, displays it and lets you manipulate it through a Python REPL" - - url = "https://raw.githubusercontent.com/datasets/airport-codes/master/data/airport-codes.csv" - - Element("header-title").element.innerText = title - Element("page-title").element.innerText = title - Element("page-message").element.innerText = page_message - - Element("txt-url").element.value = url - - # Depending on the type of DOM element, there are several alternative methods to write to it - # Element("id-of-dom-element").write("example") - # Element("id-of-dom-element").innerText = "example" - # Element("id-of-dom-element").value = "example" - # Element("id-of-dom-element").element.innerText = "example" - # Element("id-of-dom-element").element.value = "example" - # js.document.getElementById("id-of-dom-element").innerText = "example" - # js.document.getElementById("id-of-dom-element").value = "example" - - df = pd.DataFrame() - - - def loadFromURL(*ags, **kws): - global df - - # clear dataframe & output - df = pd.DataFrame() - Element("pandas-output-inner").element.innerHTML = "" - - url = Element("txt-url").element.value - log ("Trying to fetch CSV from " + url) - - df = pd.read_csv(open_url(url)) - - Element("pandas-repl").element.style.display = "block" - Element("pandas-output").element.style.display = "block" - Element("pandas-dev-console").element.style.display = "block" - - display (df, target="pandas-output-inner", append="False") - - def log(message): - # log to pyscript dev console - print (message) - - # log to JS console - js.console.log (message) - -
-
- + + + + + + + + + + + + + + + + +
+
+ +
+

Data Source

+ + +
+ + + + + + + + + + plugins = [ + "../build/plugins/python/py_tutor.py" + ] + packages = ["pandas"] + + +
+ + import pandas as pd + from pyodide.http import open_url + import sys + + title = "Pandas (and basic DOM manipulation)" + page_message = "This example loads a remote CSV file into a Pandas dataframe, displays it and lets you manipulate it through a Python REPL" + + url = "https://raw.githubusercontent.com/datasets/airport-codes/master/data/airport-codes.csv" + + Element("header-title").element.innerText = title + Element("page-title").element.innerText = title + Element("page-message").element.innerText = page_message + + Element("txt-url").element.value = url + + # Depending on the type of DOM element, there are several alternative methods to write to it + # Element("id-of-dom-element").write("example") + # Element("id-of-dom-element").innerText = "example" + # Element("id-of-dom-element").value = "example" + # Element("id-of-dom-element").element.innerText = "example" + # Element("id-of-dom-element").element.value = "example" + # js.document.getElementById("id-of-dom-element").innerText = "example" + # js.document.getElementById("id-of-dom-element").value = "example" + + df = pd.DataFrame() + + + def loadFromURL(*ags, **kws): + global df + + # clear dataframe & output + df = pd.DataFrame() + Element("pandas-output-inner").element.innerHTML = "" + + url = Element("txt-url").element.value + log ("Trying to fetch CSV from " + url) + + df = pd.read_csv(open_url(url)) + + Element("pandas-repl").element.style.display = "block" + Element("pandas-output").element.style.display = "block" + Element("pandas-dev-console").element.style.display = "block" + + display (df, target="pandas-output-inner", append="False") + + def log(message): + # log to pyscript dev console + print (message) + + # log to JS console + js.console.log (message) + +
+
+ diff --git a/examples/todo.html b/examples/todo.html index 6840f992..a15829bc 100644 --- a/examples/todo.html +++ b/examples/todo.html @@ -33,7 +33,7 @@ - +