Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

future feature discussion: multiple sketches in a single pyodide page #134

Open
villares opened this issue Nov 8, 2020 · 2 comments
Open

Comments

@villares
Copy link
Contributor

villares commented Nov 8, 2020

As I was looking at how it would feel to have a sketch running on pyodide without the editor (here) I wonder if we could make many sketch instances work in single pyodide.

@berinhard
Copy link
Owner

@villares yes, we can. I think it's just a matter of:

  1. Enabling the user to pass what is the HTML element id to place the skecth. Currently it uses only sketch-holder
  2. Stop using window.instance to store the p5.js sketch object and change it to a Javascript object. Something like:
sketch_holder = "sketch_holder"  // this can be passed by users via argument or something like that
window.pyp5js_instances = {sketch_holder:  window.instance = p5.new(sketch_setup, sketch_holder)}

The only thing to have in mind is that this should also work for Transcrypt. And this is the thing that most frighten me about having n + 1 interpreters: making sure all features are available to all of them.

IMHO, although this feature is something interesting in terms of web, I don't know if it's going be enabled in pyp5js next. I feel that there are issues with more impacts that will come first such as #132, #125 and #124.

@berinhard
Copy link
Owner

Probably once we have #189 done, this issue should also have been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants