Previewing Pyscript without have to preview in browser like Firefox/Chrome

iwannaaoe
2 Posts
iwannaaoe posted this 15 December 2023
Ask a Question

Hello everyone,

I am currently work to manage my company's database and I already use Pyscript as frontend and Flask and Matplotlib to create graph/chart. I already successfully add pyscript to Newpage's HTML element, but I have to open it on browser because Newpage will show blank background on HTML element.

Is there any way to display Pyscript on realtime editor just like Javascript? Thank you.

This is my testing code:

--

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Python in Browser</title>
<link rel="stylesheet" href="https://pyscript.net/releases/2022.12.1/pyscript.css">
<script defer="defer" src="https://pyscript.net/releases/2022.12.1/pyscript.js"></script>

<py-config>

packages = ["matplotlib"]
plugins = ["https://pyscript.net/latest/plugins/python/py_tutor.py"]

</py-config>
<py-script>

# Python Code

# importing the matplotlib library
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
# x axis
x = ["Python", "C++", "JavaScript", "Golang"]
# y axis
y = [10, 5, 9, 7]
plt.plot(x, y, marker='o', linestyle='-', color='b')
# Naming the x-label
plt.xlabel('Language')
# Naming the y-label
plt.ylabel('Score')
# Naming the title of the plot
plt.title('Language vs Score')
display(fig, target="matplotlib-lineplot")

</py-script>

Hello everyone, I am currently work to manage my company's database and I already use Pyscript as frontend and Flask and Matplotlib to create graph/chart. I already successfully add pyscript to Newpage's HTML element, but I have to open it on browser because Newpage will show blank background on HTML element. Is there any way to display Pyscript on realtime editor just like Javascript? Thank you. This is my testing code: -- <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Python in Browser</title> <link rel="stylesheet" href="https://pyscript.net/releases/2022.12.1/pyscript.css"> <script defer="defer" src="https://pyscript.net/releases/2022.12.1/pyscript.js"></script> &lt;py-config&gt; packages = ["matplotlib"] plugins = ["https://pyscript.net/latest/plugins/python/py_tutor.py"] &lt;/py-config&gt; &lt;py-script&gt; # Python Code # importing the matplotlib library import matplotlib.pyplot as plt fig, ax = plt.subplots() # x axis x = ["Python", "C++", "JavaScript", "Golang"] # y axis y = [10, 5, 9, 7] plt.plot(x, y, marker='o', linestyle='-', color='b') # Naming the x-label plt.xlabel('Language') # Naming the y-label plt.ylabel('Score') # Naming the title of the plot plt.title('Language vs Score') display(fig, target="matplotlib-lineplot") &lt;/py-script&gt;
Vote to pay developers attention to this features or issue.
3 Replies
Order By: Standard | Newest
Support Team
Support Team posted this 15 December 2023

Hi,

Thanks for your interest in Nicepage!

Unfortunately, our editor cannot render all custom codes added by users (especially scripts), but you can easily check them with the browser preview.

Let us know if you need our further help!
...................................................
Sincerely,
Paul C.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi, Thanks for your interest in Nicepage! Unfortunately, our editor cannot render all custom codes added by users (especially scripts), but you can easily check them with the browser preview. Let us know if you need our further help! ................................................... Sincerely, Paul C. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
iwannaaoe
2 Posts
iwannaaoe posted this 15 December 2023

Thank you for your information, I wish Nicepage will have live preview feature soon for custom nodes as well

Thank you for your information, I wish Nicepage will have live preview feature soon for custom nodes as well
Support Team
Support Team posted this 15 December 2023

Hi,

Thank you very much for your suggestion, we will add it to our wishlist.

Let us know if you need our further help!
...................................................
Sincerely,
Paul C.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi, Thank you very much for your suggestion, we will add it to our wishlist. Let us know if you need our further help! ................................................... Sincerely, Paul C. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
You must log in or register to leave comments