ironflow.gui.draws_widgets module
ipywidgets holds each instantiated widget independently, and they aren’t released to the garbage collector until their close method has been called and there are no further references to their instance.
If we’re not careful, this can lead to a massive bloat of the registered widgets and memory strain. Here, we introduce a abstract class to help manage the closure of the widgets we create.
- class ironflow.gui.draws_widgets.AbstractPostCaller(name, bases, namespace, /, **kwargs)[source]
Bases:
PostCaller,ABCMeta
- class ironflow.gui.draws_widgets.DrawsWidgets(*args, **kwargs)[source]
Bases:
ABCA mixin for classes that instantiate at least one ipywidgets widget during their __init__ and _only_ instantiate other widgets in methods decorated with the draws_widgets decorator.
All instantiated widgets are logged and can then be destroyed with the clear or close methods for those widgets instantiated since the last clear call or all instantiated widgets, respectively.
Children will instantiate one widget attribute, which will be of type main_widget_class, which must be of type ipywidgets.Box (i.e. it takes a list of children as its first argument.)
- Note: Child classes will need to additionally define __new__ to pull out all args
and kwargs that are explicitly passed into the init, and pass on only super().__new__(cls, *args, **kwargs) upstream.
- main_widget_class
alias of
Box
- class ironflow.gui.draws_widgets.PostCaller[source]
Bases:
typeInspired by [@Cam.Davidson.Pilon](https://stackoverflow.com/questions/795190/how-to-perform-common-post-initialization-tasks-in-inherited-classes)