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

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

Closed
hx2A opened this issue Mar 23, 2021 · 2 comments
Closed

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

hx2A opened this issue Mar 23, 2021 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@hx2A
Copy link
Collaborator

hx2A commented Mar 23, 2021

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 hx2A added bug Something isn't working help wanted Extra attention is needed labels Mar 23, 2021
@hx2A
Copy link
Collaborator Author

hx2A commented Jan 11, 2022

Update on the current situation:

  • When run through the Jupyter (either the IPython kernel or the py5 kernel), users should use the %gui osx magic before importing py5. If you forget to use the magic it will be done for you and you will see a warning. py5 will work fine for OSX users for this case.
  • The run_sketch command line utility uses the pyobjc library to perform the same sorcery that %gui osx does and makes py5 work on osx. Note that %gui osx is not available outside of Jupyter. py5 fill work fine for OSX users who are using the run_sketch utility.
  • 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.

@hx2A
Copy link
Collaborator Author

hx2A commented Apr 4, 2022

  • 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.

@hx2A hx2A closed this as completed Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant