You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But instead of simply renaming it into _delete(), we should also think about a method for removing a single element, which could be delete(). In contrast to clear() (remove all children) and remove() (remove a single child) it could be called to remove the element itself.
So I propose the following:
rename delete() to _on_delete()
introduce a new delete() that removes a single element from the UI
add (or extend) a section in the documentation explaining clear(), remove(), delete() and maybe _on_delete()
The text was updated successfully, but these errors were encountered:
Actually the title is incorrect: element.delete()does delete an element. But it is currently not the intended way, because it doesn't delete children and bindings.
falkoschindler
changed the title
element.delete() does not delete an element
element.delete() does not correctly delete an element
Aug 29, 2023
Description
Noted by @dreusel on Discord and in #1500, the
delete()
method does not actually delete an element. It is merely used internally and can be overwritten to register some cleanup procedure, like e.g. here inui.scene
:https://github.com/zauberzeug/nicegui/blob/main/nicegui/elements/scene.py#L187-L189
But instead of simply renaming it into
_delete()
, we should also think about a method for removing a single element, which could bedelete()
. In contrast toclear()
(remove all children) andremove()
(remove a single child) it could be called to remove the element itself.So I propose the following:
delete()
to_on_delete()
delete()
that removes a single element from the UIclear()
,remove()
,delete()
and maybe_on_delete()
The text was updated successfully, but these errors were encountered: