Add content argument to MainWindow instantiation
What is the problem or limitation you are having?
Right now, to create a MainWindow and add content to it, we have to do it in two steps and in a not so elegant way:
self.main_window = toga.MainWindow(
title=self.formal_name
)
self.main_window.content = self.main_box
Describe the solution you'd like
Allow assigning "content" during instantiation of MainWindow as well, so we can do it in one step and more elegantly:
self.main_window = toga.MainWindow(
title=self.formal_name,
content=self.main_box
)
This would be consistent with, for example, ScrollContainer.
Describe alternatives you've considered
- Make it consistent with other classes — that use "children" — and use "child" instead:
self.main_window = toga.MainWindow(
title=self.formal_name,
child=self.main_box
)
- Or keep things as they are, at least until other higher priority tasks are completed, as this is a minor improvement
Additional context
No response
That's an odd inconsistency - I'm surprised I didn't notice this before. Agreed that it's something we should address.
content= would seem the obvious API spelling.
Currently working on this at PyCon Sprints.
@Cameronsplaze is now looking at this in #2586.
I believe that I have everything ready. I'll submit the PR now. This is my first PR for any projects like this, and I had limited time at the sprints. Please don't let me hold anything up.