Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a clear() method to remove all children #1828

Closed
freakboy3742 opened this issue Mar 26, 2023 · 1 comment · Fixed by #1893
Closed

Add a clear() method to remove all children #1828

freakboy3742 opened this issue Mar 26, 2023 · 1 comment · Fixed by #1893
Labels
enhancement New features, or improvements to existing features. good first issue Is this your first time contributing? This could be a good place to start!

Comments

@freakboy3742
Copy link
Member

What is the problem or limitation you are having?

At present, you can:

  • add a single child to a widget (widget.add(child))
  • remove a single child to a widget (widget.remove(child))
  • add multiple children to a widget in a single call (widget.add(child1, child2))
  • Remove multiple children from a widget in a single call (widget.remove(child1, child2))

However, there is no API to remove all children from a node.

Describe the solution you'd like

widget.clear() should remove all children from a widget. As of Travertino 0.2.0, a clear() API exists; however, invoking it could have unexpected consequences, as it doesn't include the Toga-side cleanups implied by this change.

Describe alternatives you've considered

widget.remove(*widget.children) is a workaround at present, but isn't a great API.

Additional context

No response

@freakboy3742 freakboy3742 added the enhancement New features, or improvements to existing features. label Mar 26, 2023
@freakboy3742 freakboy3742 added the good first issue Is this your first time contributing? This could be a good place to start! label Apr 15, 2023
@malikoth
Copy link
Contributor

I'd like to tackle this! #pyconsprints2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features. good first issue Is this your first time contributing? This could be a good place to start!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants