[IPython-dev] Updating saved cell content with widgets
pelson.pub at gmail.com
Thu Apr 17 06:42:56 EDT 2014
Ah, I spoke too soon. It seems the "notebook_saving.Notebook" event occurs
*after* notebook serialisation (but before the data is actually sent to the
server). The code is
Is this a bug? Shouldn't the event be triggered before the JSON-ification
takes place on 1739?
On 17 April 2014 10:33, Phil Elson <pelson.pub at gmail.com> wrote:
> 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.
>> 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
>>> 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?
>>> IPython-dev mailing list
>>> IPython-dev at scipy.org
>> IPython-dev mailing list
>> IPython-dev at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev