mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 10:47:35 -05:00
* Embedding video, adding PS tag definitions * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * html -> HTML; add sphinxcontrib.youtube to env.yml * change place of sphinxcontrib.youtube in env.yml * one more sphinxcontrib-youtube change Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
35 lines
1.1 KiB
Markdown
35 lines
1.1 KiB
Markdown
# What is PyScript?
|
|
|
|
The PyScript library provides HTML tags for embedding and executing Python code in your browser. PyScript is built using [Pyodide](https://pyodide.org/en/stable/), the WebAssembly port of CPython, which is compiled using [Emscripten](https://emscripten.org/).
|
|
|
|
PyScript turns the browser into a code deployment tool that anyone can learn to use.
|
|
|
|
## Example
|
|
|
|
In this example, we are using the `<py-script>` HTML tag to generate a Matplotlib figure and display it as an image.
|
|
Click **Preview** to see the rendered HTML.
|
|
|
|
To try it in your browser, copy the code below into an online HTML editor like W3School's [Tryit Editor](https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default_default), which allows you to modify, run, and even save your code. Watch the video below to see it in action!
|
|
|
|
```{youtube} ZtC7TCt_LhU
|
|
```
|
|
|
|
::::{tab-set}
|
|
:::{tab-item} HTML Source
|
|
|
|
```{literalinclude} ../_static/examples/what-is-pyscript.html
|
|
---
|
|
linenos:
|
|
```
|
|
|
|
:::
|
|
|
|
:::{tab-item} Preview
|
|
|
|
```{raw} html
|
|
<iframe height="600px" width="100%" scrolling="auto" frameborder="0" src="../_static/examples/what-is-pyscript.html"></iframe>
|
|
```
|
|
|
|
:::
|
|
::::
|