Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion _sources/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ Contenidos:
:maxdepth: 1

index_es
index_en
index_en
pycomponent
8 changes: 8 additions & 0 deletions _sources/pycomponent.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
==============================
Interactive PyScript Component
==============================

A combined PoC of the PyScript Component with a an ehanced UI.

.. raw:: html
:file: ../pyscript.html
80 changes: 80 additions & 0 deletions pyscript.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Refresh Iframe</title>
<style>
#refreshButton {
display: block;
margin: auto;
margin-bottom: 10px;
padding: 8px 16px;
background-color: #4caf50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
</style>
</head>
<body>
<div
style="padding: 20px 40px; background-color: #fcf8e3; border-radius: 5px"
>
<button id="refreshButton">Refresh</button>
<div>
<iframe
id="pyScriptFrame"
height="300px"
width="100%"
srcdoc='
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
<style>
.py-repl-run-button {
opacity: 1;
}
#replOutput {
padding: 20px;
margin-top: 20px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #fff;
}
</style>
</head>
<body>
<py-config>
packages = ["numpy", "pandas", "matplotlib"]
terminal = false
</py-config>

<py-repl output="replOutput">
print("Hello, World!")
</py-repl>

<div id="replOutput"></div>
</body>
</html>'
style="border: 1px solid #ccc; background-color: #fff"
>
</iframe>
</div>

<script>
document
.getElementById("refreshButton")
.addEventListener("click", function () {
// Reload the content of the iframe
document
.getElementById("pyScriptFrame")
.contentWindow.location.reload(true);
});
</script>
</div>
</body>
</html>