MCPcopy
hub / github.com/beeware/toga / __init__

Method __init__

core/src/toga/window.py:972–992  ·  view source on GitHub ↗

Create a new Main Window. Accepts the same arguments as [`Window`][toga.Window].

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls 4

CommandSetClass · 0.90
__init__Method · 0.45
create_menusMethod · 0.45
create_toolbarMethod · 0.45

Tested by

no test coverage detected