Hi Nicolas,

I think that this would be a good think to do to handle the case when a
widget (model) is completely closed from the front-end. However, is it more
subtle than it sounds.

Widgets implement a MVC pattern. The Widget object on the Python side is
synchronized with a Javascript "Model". The kernel has no notion of view,
or how many views exist for a given model. This design is a consequence of
the agnosticity of the architecture to the front-end. The kernel should not
know the nature of the (possibly multiple) clients that are connected to it.

In the notebook, the X button only closes a view from the document.
Destroying a view does not mean that the widget model is destroyed and
triggers no action in the backend.

Sylvain


On Wed, Dec 21, 2016 at 12:17 AM, <nleclercq...@gmail.com> wrote:

> Hi all,
>
> I need to stop a thread running in the background when the associated
> interface (i.e. main ipywidget) is closed or when the associated cell is
> deleted. Not doing so would lead to a bunch of zombie threads after a
> while. So my questions are:
>
> Is there a way to be notified when the user click on close button of a
> ipywiget?
> I tried the 'observe' way but it doesn't seem to work - the callback is
> not called when I close the widget.
>
> As a workaround, hiding the 'X' button could also be a solution cause I
> can provide my own 'close' button.
> Is it possible to hide the default X button?
>
> Concerning the cells, is there a way to be notified when a specific cell
> is removed from the notebook?
>
> Thanks for your help,
> Nicolas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+unsubscr...@googlegroups.com.
> To post to this group, send email to jupyter@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jupyter/15ad43d9-cca1-477d-b917-3a55721b2472%40googlegroups.com
> <https://groups.google.com/d/msgid/jupyter/15ad43d9-cca1-477d-b917-3a55721b2472%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAK%3DPhk4GBk%2Bkrp1JFP1uyczsuG-dDSRXhnK%3Dz8UCnDeiLc8PnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to