-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b71a255
commit 3bd6e1e
Showing
4 changed files
with
22 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>PyPrez</title> | ||
</head> | ||
<body> | ||
<script src="https://modularizer.github.io/pyprez/pyprez.js" mode="editor"> | ||
import numpy as np | ||
print("testing") | ||
np.random.rand(5) | ||
<!-- shortest pyprez example possible --> | ||
<script src="https://modularizer.github.io/pyprez/pyprez.js"> | ||
import random | ||
random.random() | ||
</script> | ||
<pyprez-editor language="js"> | ||
pyprez.loadAndRunAsync(` | ||
from js import alert | ||
alert("pyodide object has loaded and is available at window.pyodide") | ||
`) | ||
</pyprez-editor> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
""" | ||
the <pyprez-editor> tag can take an attribute src='./path_to_some_python_file_served_online.py' and it will display the | ||
content for you to edit and run. | ||
the <pyprez-script> tag can similarly take a src attribute, but it will execute the python script as soon as it loads | ||
instead of putting it into a code demo text box. | ||
this is a sample script that can be imported to test the <pyprez-editor> and <pyprez-script> tags. | ||
""" | ||
|
||
import numpy as np | ||
|
||
for i in range(5): | ||
print(np.random.rand(5)) # this should print to the developer console with console.log | ||
# unless the stdout has already been rerouted by using javascript, e.g. pyprez.stdout=alert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters