Skip to content

Latest commit

 

History

History
80 lines (60 loc) · 1.63 KB

File metadata and controls

80 lines (60 loc) · 1.63 KB
py-config
splashscreen packages
autoclose
true
matplotlib
hallo_world-0.1.0-py2.py3-none-any.whl

Example with MyST

py-repl and py-terminal

We can create a REPL which will output to a div and print stdout to a terminal with:

```{py-repl}
:output: replOutput

print("hallo world")
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.gcf()
```

<div id="replOutput"></div>

```{py-terminal}
```

Press shift+enter to run the code.

:output: replOutput

print("hallo world")
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.gcf()

py-script application

Here is a simple application to replace "a" with "b", using the py-script directive:

```{py-script}
:file: convert_json_to_toml.py
```

<form method="post">
    <label for="input_text" style="display: block">Input</label>
    <textarea id="input_text" name="input_text" style="width: 90%">a</textarea>
    <label for="output_text" style="display: block">Output</label>
    <textarea id="output_text" name="output_text" readonly="true" style="width: 90%">b</textarea>
</form>

with the following code:

:language: python
:file: convert_json_to_toml.py
Input <textarea id="input_text" name="input_text" style="width: 90%">a</textarea> Output <textarea id="output_text" name="output_text" readonly="true" style="width: 90%">b</textarea>