[IPython-dev] Updating saved cell content with widgets

Jonathan Frederic jon.freder at gmail.com
Wed Apr 16 20:44:00 EDT 2014


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140416/b03d02f5/attachment.html>


More information about the IPython-dev mailing list