Sylvain,
I have a 'model' per thread, i.e. a dedicated widgets layout per thread, 
adding my own close button would do the job. Ok, this approach doesn't 
cover the cell closed case but it could act as a 'not so bad' workaround. 
Thanks.
N.

Le jeudi 22 décembre 2016 13:45:48 UTC+1, Sylvain Corlay a écrit :
>
> 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, <[email protected] <javascript:>> 
> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> 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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/8bd1f820-da38-452b-99b6-73d705753382%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to