comms is what I'm looking for thank you :)
On Saturday, November 19, 2016 at 4:14:50 PM UTC+2, takowl wrote: > > On 18 November 2016 at 21:05, Logan Page <[email protected] <javascript:>> > wrote: > >> I have created some ipython cell magics (kernel extension) that populates >> a json object when a cell is executed. >> I need to get this json object into the front-end (javascript notebook >> extension) once complete. >> >> The hack I am using at the moment is simply to print the json str from >> ipython and use an "executed.CodeCell" event to wait for the output (print >> info). > > > One way you could do this is to have your notebook extension define a > Javascript callback function and make it globally accessible (which could > be by making it a handler for a new event you define, for instance). Then > you could wrap the JSON from the kernel in a call to that function and > display it as Javascript: > > display(Javascript("my_callback_function(%s)" % json.dumps({'object from': > 'kernel'}))) > > This would be called again whenever the notebook is loaded, though, as the > displayed Javascript is saved as an output. > > A nicer solution involving a bit more work would be to use comms to send > your data: > http://jupyter-notebook.readthedocs.io/en/latest/comms.html > -- You received this message because you are subscribed to the Google Groups "Project Jupyter" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/3ba30c86-6342-4c95-9304-d31e0971fae1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
