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

hook up display system #323

Open
SimonDanisch opened this issue Sep 16, 2019 · 5 comments
Open

hook up display system #323

SimonDanisch opened this issue Sep 16, 2019 · 5 comments
Labels

Comments

@SimonDanisch
Copy link

Can we by default have python jlwrap objects be hooked up to the display system?
It should just be a matter of overloading the correct repr methods.
E.g. just attach these defitions to the python object:

def _repr_html_(self):
   return Main.repr(Main.eval('MIME"image/png"()'), self)

Or something like this ;)

@tkf tkf added the PyCall label Sep 16, 2019
@tkf
Copy link
Member

tkf commented Sep 16, 2019

It's possible
https://github.com/tkf/ipyjulia_hacks
https://github.com/tkf/PyBase.jl
but this requires a change in PyCall to do it without type-piracy:
JuliaPy/PyCall.jl#617

@SimonDanisch
Copy link
Author

Cool! I'll try it out... But it seems to me, that one wouldn't need anything complicated to get this working, right? Just add the repr methods to the wrapper class and we're done, wouldn't we?

@stevengj
Copy link
Member

stevengj commented Sep 17, 2019

Just adding the repr methods to the wrapper class should be sufficient. In general, there are lots of small self-contained PRs that could potentially be written to enhance the functionality of the wrapper class a little at a time.

@SimonDanisch
Copy link
Author

Can you point me to where this could be done? It wasn't easy for me to find the place for such additions, since everything seems to be done via the c interface...

@tkf
Copy link
Member

tkf commented Sep 17, 2019

JuliaPy/PyCall.jl#617 is where it's happening

But you can also create a Python shim class (that's the trick I used in PyBase and ipyjulia_hacks).

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

No branches or pull requests

3 participants