Toolbars, Menubars & Statusbars


Toolbars and Menubars are features common to most GUIs, you'll be used to seeing them along the top of apps, such as MS Word.
Statusbars are also useful features, they allow you to show information about what's going on in a GUI, usually along the bottom of the app.

Toolbar


Toolbars (sometimes known as ribbons) appear across the top of a GUI.
They offer a series of buttons to click, which can be used to change settings/functionality in a GUI. Toolbar

tools = ["ABOUT", "REFRESH", "OPEN", "CLOSE", "SAVE",
        "NEW", "SETTINGS", "PRINT", "SEARCH", "UNDO",
        "REDO", "PREFERENCES", "HOME", "HELP", "CALENDAR",
        "WEB", "OFF"]

app.addToolbar(tools, tbFunc, findIcon=True)

Create Toolbars

Set Toolbars


Adds a standard Menubar along the top of the GUI.
On Windows/Linux a menubar will only be shown, once the first menu has been added.
On Mac, a menubar is always present.
Menubars are made up of a series of menus, each containing a list of names.
These names can be menu-items, radio buttons, check boxes, separators, or sub-menus.

Create Menus

MenuList

fileMenus = ["Open", "Save", "Save as...", "-", "Export", "Print", "-", "Close"]
app.addMenuList("File", fileMenus, menuPress)

MenuRB_CB

app.createMenu("Config")

for i in range(5):
    app.addMenuRadioButton("Config", "font", "1" + str(i), menuPress)

app.addMenuSeparator("Config")

for i in range(5):
    app.addMenuCheckBox("Config", "Size 1" + str(i), menuPress)

SubMenu

app.createMenu("Config")
app.addSubMenu("Config", "Font Size")
for i in range(5):
    app.addMenuRadioButton("Font Size", "font", "1" + str(i), menuPress)

Set Menus

Get Menus


Extra Features:


Platform Specific/Custom Menus

It's possible to interact with menus that are specific to particular platforms, or prebuilt for specific purposes.
Simply use the menu names given below when adding menu-items to a menu.

Linux Menu

app.addMenuItem("appJar", "Help", app.appJarHelp)
app.addMenuItem("appJar", "About", app.appJarAbout)

Statusbar


Adds a statusbar along the bottom of the GUI. This can be used for easy debugging, as info for the user, or to show current settings.

Statusbar

app.addStatusbar(fields=3)
app.setStatusbar("Line: 20", 0)
app.setStatusbar("Column: 4", 1)
app.setStatusbar("Mode: Edit", 2)

Statusbar

app.addToolbar(tools, tbFunc, True)
app.addStatusbar(fields=3, side="RIGHT")
# NOTE: 0 is now on the right
app.setStatusbarWidth(50, 2)
app.setStatusbarBg("red", 2)
app.setStatusbarFg("white", 2)

Create Statusbars

Set Statusbars