[IPython-dev] Notebook back/front data communications

Pierre Villeneuve pierre.villeneuve at gmail.com
Thu May 8 15:29:26 EDT 2014


I'm working on building an image display custom widget based on the HTML
CanvasElement.  I want to be able to update image transform properties and
to respond to mouse motion and clicks.  My first time though I placed most
of my JavaScript event handlers inside the widget's update() function.  And
it noticed I was updating the image data even for a small event like a
change in the canvas width.  It seemed like there was a lot of unnecessary
processing and data transfer going on, so I decided to look into using the
custom messages instead.  I think my new approach is more efficient, but it
does involve writing more code for my event handlers.
​
​Now I am wondering which of these two approaches is 'best', if there even
is such a thing?  Most of the widgets I see included with the IPython
source code involve rather simple data structures, e.g. a single floating
point number, or a text string.  In my case I plan to work with ​large
images.  I think I just convinced myself that my second approach is more
appropriate since my data is not trivially small.

​

*Pierre Villeneuve*
pierre.villeneuve at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140508/3b491d31/attachment.html>


More information about the IPython-dev mailing list