<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-09-24 23:59 GMT+02:00 Doug Blank <span dir="ltr"><<a href="mailto:doug.blank@gmail.com" target="_blank">doug.blank@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>It isn't too complicated, if you can format your JavaScript in the kernel language; here is JavaScript talking to Python:</div><div><br></div><div>%%javascript</div><div>var javascript_var = 2 * 4 + 8;<br></div><div>IPython.notebook.kernel.execute("python_var = " + javascript_var);</div><div><br></div><div>Hope that helps.</div></div></blockquote><div><br></div><div>Hi Doug,<br><br></div><div>It helps but it is not what I want.<br><br></div><div>I want to access a object stored in the global js namespace of the browser. For instance, this is available in your js console on the browser when you work with IPython/Jupyter:<br><i>IPython.notebook.notebook_name</i><br><br></div><div>But if I do:<br><i>%%javascript<br>IPython.notebook.kernel.execute("python_var = " + IPython.notebook.notebook_name);</i><br></div><div> <br></div><div>It doesn't work.<br><br></div><div>In your example, where is <i>javascript_var</i> stored?<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span class=""><font color="#888888"><div><br></div><div>-Doug</div></font></span><div><div class="h5"><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 24, 2015 at 5:44 PM, Kiko <span dir="ltr"><<a href="mailto:kikocorreoso@gmail.com" target="_blank">kikocorreoso@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div>2015-09-24 23:41 GMT+02:00 Wes Turner <span dir="ltr"><<a href="mailto:wes.turner@gmail.com" target="_blank">wes.turner@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span><p dir="ltr"><br>
On Sep 24, 2015 4:32 PM, "Kiko" <<a href="mailto:kikocorreoso@gmail.com" target="_blank">kikocorreoso@gmail.com</a>> wrote:<br>
><br>
> 2015-09-24 23:25 GMT+02:00 Wes Turner <<a href="mailto:wes.turner@gmail.com" target="_blank">wes.turner@gmail.com</a>>:<br>
>><br>
>> <a href="https://www.google.com/search?q=ipython+d3" target="_blank">https://www.google.com/search?q=ipython+d3</a><br>
>><br>
>> Vega visualization grammar<br>
>> | Docs: <a href="https://github.com/vega/vega/wiki/Vega-and-D3" target="_blank">https://github.com/vega/vega/wiki/Vega-and-D3</a><br>
>> | Homepage: <a href="https://vega.github.io/" target="_blank">https://vega.github.io/</a><br>
>><br>
>> mpld3: matplotlib + d3<br>
>> | Homepage: <a href="http://mpld3.github.io/" target="_blank">http://mpld3.github.io/</a><br>
>><br>
>> IPython widgets (interactive)<br>
>> | Docs: <a href="https://github.com/ipython/ipython/wiki/widgets" target="_blank">https://github.com/ipython/ipython/wiki/widgets</a><br>
>><br>
>> pythreejs IPython Notebook extension<br>
>> | Src: <a href="https://github.com/jovyan/pythreejs/blob/master/pythreejs/pythreejs.py" target="_blank">https://github.com/jovyan/pythreejs/blob/master/pythreejs/pythreejs.py</a> three.js<br>
>> | Src: <a href="https://github.com/jovyan/pythreejs/blob/master/pythreejs/nbextension/pythreejs.js" target="_blank">https://github.com/jovyan/pythreejs/blob/master/pythreejs/nbextension/pythreejs.js</a><br>
>><br>
>> * [ ] JSON-LD<br>
>>    * <a href="http://json-ld.org/playground/" target="_blank">http://json-ld.org/playground/</a><br>
><br>
> Thanks.<br>
><br>
> Yes, I think all of these allow you to send information from Python to js but I'm talking about the opposite way. For instance, select an area in an openlayers map and then get the coordinates of the area back to Python.</p>
</span><p dir="ltr">IIUC, that's more or less how widget controls operate.</p>
<p dir="ltr">also, here's this:</p>
<p dir="ltr">ipython-jsobject<br>
Src: <a href="https://github.com/jdfreder/ipython-jsobject" target="_blank">https://github.com/jdfreder/ipython-jsobject</a></p>
<p dir="ltr">    JSON-LD (and/or e.g. CSVW) with RDFJS could be helpful: <a href="https://github.com/rdfjs/rdfjs.org" target="_blank">https://github.com/rdfjs/rdfjs.org</a><br>
     * <a href="https://github.com/rdfjs/rdfjs.org/wiki/Projects" target="_blank">https://github.com/rdfjs/rdfjs.org/wiki/Projects</a> #LinkedData<br>
     * <a href="http://www.w3.org/community/rdfjs/wiki/Comparison_of_RDFJS_libraries" target="_blank">http://www.w3.org/community/rdfjs/wiki/Comparison_of_RDFJS_libraries</a><br>
       * [ ] TODO: link these resources</p></blockquote></div></div><div>Thanks, I will review that to check if I can obtain any hints.<br></div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div>
<p dir="ltr"><br></p></div></div></blockquote></div></div></div></div></div></blockquote></div></div></div></div></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/ipython-dev" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div><br></div></div>