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

pyganja in Jupyterlab - by ext only? #49

Open
ae1234567 opened this issue Jul 31, 2020 · 5 comments
Open

pyganja in Jupyterlab - by ext only? #49

ae1234567 opened this issue Jul 31, 2020 · 5 comments

Comments

@ae1234567
Copy link

Finding pyganja works superbly in Jupyter notebooks,
but Jupyterlab places restriction against unmediated javascript.
Option is to write an extension, but thought to ask if you
have recommendation in this direction.
Thank you for your incredibly good work!
-ae-

@BeinerF
Copy link

BeinerF commented Aug 27, 2020

Same question here.
Thx

@hugohadfield
Copy link
Member

Hi both, sorry for the slow reply on this, things have been pretty busy! We currently don't have plans to write a jupyterlab extension but it should be very possible to get around the javascript issue in pyganja by using the other keywords to the draw command:

def draw(objects, color=Color.DEFAULT, sig=None, *,

I think the new_window flag should be able to help you out, eg:

from clifford.tools.g3c import *
from pyganja import *
draw([random_line() for i in range(10)], new_window=True)

This will hopefully pop up a new window with your visualisation in it. If you want the visualisations inline in the notebook then you might have to have a search around for a jupyterlab extension which allows the javascript to run as normal. If you happen to come across an extension like that then let us know as other people might be in a similar position!

@ae1234567
Copy link
Author

Many thanks, as always. Yes, this flag works fine!
Jupyter Lab extensibility seems a deeper dive. Also,
Lab and Notebook "servers" seem indistinguishable,
at least through IPython core (e.g., get_ipython()).
But Lab gives easy access to "old" "notebook format".
: )

@BeinerF
Copy link

BeinerF commented Sep 1, 2020 via email

@sbliven
Copy link

sbliven commented Jun 14, 2022

I guess this issue is the cause of "Javascript Error: context is undefined" errors in jupyterlab. Adding new_window=True hides the error but doesn't actually display anything for me (Firefox 101, popup blocking disabled)

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

4 participants