pyjulia
pyjulia copied to clipboard
hook up display system
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 ;)
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: https://github.com/JuliaPy/PyCall.jl/issues/617
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?
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.
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...
https://github.com/JuliaPy/PyCall.jl/issues/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).