py5coding / py5generator

Meta-programming project that creates the py5 library code.
https://py5coding.org/
GNU General Public License v3.0
52 stars 13 forks source link

py5 doesn't work on OSX without using Jupyter and `%gui osx` magic #4

Closed hx2A closed 2 years ago

hx2A commented 3 years ago

py5 doesn't work on OSX without using Jupyter and %gui osx magic. The sketch will be running but the window is not visible.

  1. Create any sketch with any renderer
  2. Call run_sketch
  3. Window will not appear
  4. frame_count number will be increasing and the output of print statements will appear

Ideally, py5 should work with a regular Python interpreter. I can live with the fact that the %gui osx magic is necessary when using Jupyter notebooks, but this leaves a dependency on Jupyter. Users may want to create a Python script to run a Sketch without having to use Jupyter.

py5 uses JPype as the Python-Java bridge, and there is a known issue in JPype related to this. I believe this problem is dependent on a fix for this JPype issue.

hx2A commented 2 years ago

Update on the current situation:

hx2A commented 2 years ago
  • Currenttly py5 does not work with the generic python interpreter on OSX because gui osx is not available and the pyobjc stuff is not (yet) present.

  • Eventually I would like to use pyobjc for running py5 sketches anywhere on OSX, eliminating the need for %gui osx entirely. This may not be possible though given what the IPython kernel already does for animation threads, but it also isn't that important, as calling %gui osx is not big deal. It should be possible to use pyojbc to get py5 working with the generic python interpreter. I have a partially working solution for this and will complete it at some point.

With release 0.7.2, released very soon, this will be resolved. py5 will use pyobjc when executing sketches through the generic python interpreter.