<div dir="ltr"><div><div>Thanks Jon,<br><br></div>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 'notebook_saving.Notebook'.<br>
<br></div><div>I think I have all the pieces now.<br></div><div><br></div>Cheers,<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 17 April 2014 01:44, Jonathan Frederic <span dir="ltr"><<a href="mailto:jon.freder@gmail.com" target="_blank">jon.freder@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Phil,<div><br></div><div>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.</div>

<div><br></div><div>Cheers,</div><div>Jon</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Wed, Apr 16, 2014 at 12:00 AM, Phil Elson <span dir="ltr"><<a href="mailto:pelson.pub@gmail.com" target="_blank">pelson.pub@gmail.com</a>></span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div><div><div>I've been playing with the slider widget and have defined a callback along the lines of:<br>

<br><br><pre style="margin-left:40px"><span>from</span> <span>IPython.html</span> <span>import</span> <span>widgets</span>

<span>slider</span> <span>=</span> <span>widgets</span><span>.</span><span>IntSliderWidget</span><span>(</span><span>min</span><span>=-</span><span>20</span><span>,</span> <span>max</span><span>=</span><span>20</span><span>,</span> <span>value</span><span>=</span><span>10</span><span>)</span></pre>


<pre style="margin-left:40px"><span>def</span> <span>on_value_change</span><span>(</span><span>name</span><span>,</span> <span>value</span><span>):</span>
    <span>from</span> <span>IPython.core.display</span> <span>import</span> <span>clear_output</span>
    <span>clear_output</span><span>(</span><span>wait</span><span>=</span><span>True</span><span>)</span>
    <span>print</span> <span>'Current value:'</span><span>,</span> <span>value</span>

<span>slider</span><span>.</span><span>on_trait_change</span><span>(</span><span>on_value_change</span><span>,</span> <span>'value'</span><span>)</span></pre>
<br></div>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?<br>


</div></div><div><br></div>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?</div>


<br></div><div>Cheers!<span><font color="#888888"><br><br></font></span></div><span><font color="#888888"><div>Phil<br></div></font></span></div>
<br></div></div>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div><br></div>