[IPython-dev] custom widget example : python and javascript

Massimo Di Stefano massimodisasha at gmail.com
Mon Nov 12 11:10:47 EST 2012


Hi IPython!


i was tring to learn how to code a cell in order to have interaction between  python <->  Javascript (jquery?)

i can try to explain with an example …

let's say i have a dictionary in python :


>>>mydict = {'key1':'val1', 'key2':'val2'}

and a function that take as input the dict and print out the value :

>>>def printval(mydict, keyN):
           print maydict['keyN']


what i'm tring to learn is :

 how to render inside an "IPython notebook cell"   a js gui tool like a "dropdown menu"  that will contain the "mydict keys"
 and  button that will connect the selected value in the dropdown menu to the printval function ?

i guess it should be trivial for who knows the how the internal engine works, i was really attracted by the  new "js plugin system" (i saw it in NYC at the PyData … cool!)
for me an example like this can be a perfect starting point to start to develop something useful ….

thamk you for you great support!

Massimo.




More information about the IPython-dev mailing list