Skip to content

Remove All Child Widgets #1110

Answered by davep
aaronst asked this question in Q&A
Nov 4, 2022 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

One way to do this would be to use the child combinator to get a query of all the children of a particular node, then use the remove loop-free operation with that query.

However... internally it does more or less what you're doing right now and has the same performance hit. I don't think it's been raised as a particular issue just yet, but @willmcgugan has identified that remove on a query needs some work to make it faster (this came about last weekend when I ran into the same thing as you, only using what I'm suggesting here, to remove 1,600 widgets in one go).

In short: personally I think remove on a query is the way to go and the speed should then improve in a future release of Textual.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@aaronst
Comment options

@davep
Comment options

@aaronst
Comment options

Answer selected by aaronst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants