P5js in Python Mode with pyp5js: Forbidden


I am trying to run p5.js in Python Mode.

Some background
There is a pyp5js library that uses pyodide to compile python code that runs in the browser.
I saw several examples of Python Mode that were running, but most of them are facing an issue with the pyodide.js certificate.

The problem…
I have the Python Mode working with another source, but when I apply the pyp5js library to it, I am not able to see the canvas rendering.
The code seems to be compiled without errors and running.
The strange thing I noticed is that HTMLCanvasElement has several Forbidden properties.

The code is here:

Thank you in advance!

Welcome to the forums @Vamoss! Your notebook link currently doesn’t work because your notebook is private. To share the notebook so others can view it, please click the ... menu in the top right of the page and choose “Enable link sharing”.

1 Like

Thank you @bgchen ! It is now open :slight_smile:

hi @Vamoss it looks like it’s working, you have to wrap the HTMLCanvasElement with html literal so it renders appropriately

ps. crazy to see python running on the browser I didn’t know you could run pyodide outside their notebook environment

Thank you very much! Wonderful contribution :slight_smile:
I updated my notebook and it working nicely!

PS: I saw we are both brazilians :sweat_smile:

1 Like

I just saw that I wrote pyp5js, this is another amazing project from Bernardo Fontes:

What I was actually using here was py5js: