Stef1611
Stef1611

Reputation: 2409

Ipywidgets : How to get the list of comm opened in a jupyter notebook?

I created, in a Jupyter Notebook, a GUI where many ipywidgets are created, displayed or not, closed depending of user choices, file opened, ... But I am not sure that I do not let some comms (https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Low%20Level.html#comms) opened. For example, in this simple code :

my_list = [1,2,3]
my_HBox = wg.HBox()
my_HBox.children = ( [ wg.Checkbox(value=True, description=f'{i}') for i in my_list ] )
display(my_HBox)

If my_HBox is closed (my_HBox.close()). The comms for the three checkboxes still exist. Even if they are not displayed because my_HBox has been closed. Indeed, they could be displayed and used, for example, display(my_HBox.children[1]).

I read carefully https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Low%20Level.html. So, I understand what happens in the example above.

But in the GUI, I designed, I am not sure to close all the childrens of childrens of childrens ... Because of the GUI complexity, perhaps, I could have missed some of them.

So, I am looking for a function (a method or something else) to get the list of all comms opened in a Jupyter Notebook. That means the list of Widget (in Python Kernel) and WidgetModel (in front-end) associated via a comms

Upvotes: 0

Views: 16

Answers (0)

Related Questions