Create a new Main Window. Accepts the same arguments as [`Window`][toga.Window].
(self, *args, **kwargs)
| 970 | _WINDOW_CLASS = "MainWindow" |
| 971 | |
| 972 | def __init__(self, *args, **kwargs): |
| 973 | """Create a new Main Window. |
| 974 | |
| 975 | Accepts the same arguments as [`Window`][toga.Window]. |
| 976 | """ |
| 977 | super().__init__(*args, **kwargs) |
| 978 | |
| 979 | # Create a toolbar that is linked to the app. |
| 980 | self._toolbar = CommandSet(app=self.app) |
| 981 | |
| 982 | # If the window has been created during startup(), we don't want to install a |
| 983 | # change listener yet, as the startup process may install additional commands - |
| 984 | # we want to wait until startup is complete, create the initial state of the |
| 985 | # menus and toolbars, and then add a change listener. However, if startup *has* |
| 986 | # completed, we can install a change listener immediately, and trigger the |
| 987 | # creation of menus and toolbars. |
| 988 | if self.app.commands.on_change: |
| 989 | self._toolbar.on_change = self._impl.create_toolbar |
| 990 | |
| 991 | self._impl.create_menus() |
| 992 | self._impl.create_toolbar() |
| 993 | |
| 994 | @property |
| 995 | def toolbar(self) -> CommandSet: |
nothing calls this directly
no test coverage detected