This example shows how to add a custom pop-up menu next to the Display… menu in the bottom bar of the Glyph Window.

The items in the custom menu can be toggled on/off:

from vanilla import FloatingWindow, PopUpButton
from mojo.UI import CurrentGlyphWindow
from import addObserver, removeObserver

class CustomGlyphWindowDisplayMenu:

    def __init__(self, menuTitle, menuItems, width=85):
        self.title = menuTitle
        self.items = menuItems
        self.width = width
        addObserver(self, "glyphWindowDidOpenObserver", "glyphWindowDidOpen")

    def window(self):
        return CurrentGlyphWindow()

    def bar(self):
        if not self.window:
        return self.window.getGlyphStatusBar()

    def glyphWindowDidOpenObserver(self, info):
        if not

        if hasattr(, "menuButton"):

        menuItems = list(self.items.keys())
        menuItems.insert(0, self.title) = PopUpButton((120, 0, self.width, 16), menuItems, sizeStyle="small", callback=self.callback)

        for i, menuItem in enumerate([1:]):
            value = list(self.items.values())[i-1]

    def callback(self, sender):
        item = sender.getNSPopUpButton().selectedItem()
        item.setState_(not item.state())
        selection = []
        for i, menuItem in enumerate([1:]):
            if menuItem.state():

CustomGlyphWindowDisplayMenu('hello world', {'A': True, 'B': True, 'C': False})
Last edited on 02/06/2020