[IPython-dev] Updating saved cell content with widgets

Phil Elson pelson.pub at gmail.com
Thu Apr 17 05:33:14 EDT 2014

Thanks Jon,

You're right - it does save the output. For anybody who finds this email in
the future, the event I was looking for to hook into was

I think I have all the pieces now.


On 17 April 2014 01:44, Jonathan Frederic <jon.freder at gmail.com> wrote:

> Hi Phil,
> Static widgets are on the roadmap for IPython 3.0; however, the print
> value (stdout) should be saved in the notebook and visible upon export via
> nbconvert (or download as).  After changing your slider, did you explicitly
> save by clicking Ctrl+S or File>Save and Checkpoint... ?  If the stdout is
> still not being stored, we will need to file an issue on Github.
> Cheers,
> Jon
> On Wed, Apr 16, 2014 at 12:00 AM, Phil Elson <pelson.pub at gmail.com> wrote:
>> I've been playing with the slider widget and have defined a callback
>> along the lines of:
>> from IPython.html import widgets
>> slider = widgets.IntSliderWidget(min=-20, max=20, value=10)
>> def on_value_change(name, value):
>>     from IPython.core.display import clear_output
>>     clear_output(wait=True)
>>     print 'Current value:', value
>> slider.on_trait_change(on_value_change, 'value')
>> The problem with this though is that when I save the notebook, neither
>> the slider nor the printed value are stored in the notebook file on save.
>> Is there a way to update the content of the stored cell either from within
>> the callback, or via an alternative hook?
>> The answer might be identical, but I'm also working on my own widget
>> which I would like to save a static representation of inside the notebook
>> file (as HTML). Is there an "on-save" hook I can attach a callback to to
>> convert my dynamic widget into a static on at save time?
>> Cheers!
>> Phil
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140417/4f838ec6/attachment.html>

More information about the IPython-dev mailing list