MainWindow¶
Usage¶
A toga.MainWindow is a toga.Window that can serve as the main interface to an application. A toga.MainWindow may optionally have a toolbar. The presentation of toga.MainWindow is platform dependent:
- On desktop platforms that place menus inside windows (e.g., Windows, and most Linux window managers), a
toga.MainWindowinstance will display a menu bar that contains the defined appcommands. - On desktop platforms that use an app-level menu bar (e.g., macOS, and some Linux window managers), the window will not have a menu bar; all menu items will be displayed in the app bar.
- On mobile, web and console platforms, a
toga.MainWindowwill include a title bar that can contain both menus and toolbar items.
Toolbar items can be added by adding them to toolbar; any command added to the toolbar will be automatically added to the App's commands as well.
import toga
main_window = toga.MainWindow(title='My Application')
self.toga.App.main_window = main_window
main_window.show()
Reference¶
Bases: Window
Source code in core/src/toga/window.py
973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | |
toolbar
property
¶
Toolbar for the window.
__init__(*args, **kwargs)
¶
Create a new Main Window.
Accepts the same arguments as Window.
Source code in core/src/toga/window.py
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | |