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 content argument to MainWindow instantiation #2307

Closed
hyuri opened this issue Dec 29, 2023 · 4 comments · Fixed by #2314 or #2586
Closed

Add content argument to MainWindow instantiation #2307

hyuri opened this issue Dec 29, 2023 · 4 comments · Fixed by #2314 or #2586
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

@hyuri
Copy link

hyuri commented Dec 29, 2023

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

  1. 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
)
  1. 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

@hyuri hyuri added the enhancement New features, or improvements to existing features. label Dec 29, 2023
@freakboy3742
Copy link
Member

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.

@freakboy3742 freakboy3742 added the good first issue Is this your first time contributing? This could be a good place to start! label Dec 30, 2023
@Franklin19c
Copy link

Currently working on this at PyCon Sprints.

@mhsmith
Copy link
Member

mhsmith commented May 20, 2024

@Cameronsplaze is now looking at this in #2586.

@Franklin19c
Copy link

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.

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
4 participants