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

On Windows, the creation of MainWindow renders it in the display without calling show() #2653

Closed
rmartin16 opened this issue Jun 14, 2024 · 1 comment · Fixed by #2651
Closed
Labels
bug A crash or error in behavior. windows The issue relates to Microsoft Windows support.

Comments

@rmartin16
Copy link
Member

Describe the bug

On Windows, the MainWindow for an app is shown when it is instantiated instead of when show() is called.

Steps to reproduce

MRE:

import toga


class MyApp(toga.App):
    def startup(self):
        self.main_window = toga.MainWindow(title=self.formal_name)


MyApp("MyApp", "www.example.org").main_loop()

Expected behavior

The window should be shown only after show() is called; at least, this is the behavior on Linux, so everything should at least be consistent.

Screenshots

No response

Environment

  • Operating System: Windows 11
  • Python version: 3.10.14
  • Software versions:
    • Briefcase: 0.3.19
    • Toga: 0.4.5.dev159+g0d736a41c

Logs

No response

Additional context

No response

@rmartin16 rmartin16 added bug A crash or error in behavior. windows The issue relates to Microsoft Windows support. labels Jun 14, 2024
@freakboy3742
Copy link
Member

It looks like displaying the form is a side effect of setting the MainForm of the ApplicationContext (see App.set_main_window()).

This was historically required because the Winforms async proactor was bound to the main form; however, this hasn't been true since we merged #2112. I'm in the process of reworking main window handling as allowing background and session-based apps (#2651); I'll fix it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. windows The issue relates to Microsoft Windows support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants