mojo.UI

getGlyphViewDisplaySettings()

Return a dictionary with the current display settings of a glyph view.

setGlyphViewDisplaySettings(settings)

Set display options for the current glyphview. Input as dict. These settings will be default for the glyphview. All options are: Fill, Stroke, Metrics, On Curve Points, Off Curve Points, Point Coordinates, Anchors, Curve Length, Blues, Family Blues, Rulers

AllSpaceCenters(currentFontOnly=False)

Return a list of all open Space Centers.

currentFontOnly
Optionally only return the space centers for the current font.

CurrentSpaceCenter(currentFontOnly=False)

Return the current Space Center.

currentFontOnly
Optionally only return the space center for the current font.

AllSpaceCenterWindows(currentFontOnly=False)

Return a list of all open Space Center windows.

currentFontOnly
Optionally only return the space center windows for the current font.

CurrentSpaceCenterWindow(currentFontOnly=False)

Return the current Space Center Window.

currentFontOnly
Optionally only return the space center window for the current font.

SpaceCenterToPDF(path, spaceCenter=None, currentFontOnly=False)

Save the Space Center as a pdf.

path
The path to save the pdf.
spaceCenter
Optionally provide a space center, as default it takes the current space center.
currentFontOnly
Optionally only return the space center for the current font.

AllGlyphWindows(currentFontOnly=False)

Get all open Glyph windows.

currentFontOnly
Optionally only return the glyph windows for the current font.

CurrentGlyphWindow(currentFontOnly=False)

Get the current Glyph Window.

currentFontOnly
Optionally only return the glyph window for the current font.

GlyphWindowToPDF(path, glyphWindow=None, currentFontOnly=False)

Save the glyph window editing view as a .pdf

path
The path to save the pdf.
glyphWindow
Optionally provide a glyph window, as default it takes the current glyph window.
currentFontOnly
Optionally only return the glyph window for the current font.

AllFontWindows()

Return all open font windows.

CurrentFontWindow()

Return the current Font Window.

AllWindows(currentFontOnly=False)

Return all open font related windows. Will be a list containing a FontWindows, GlyphWindows, SpaceCenters, SingleFontWindows.

currentFontOnly
Optionally only return the windows for the current font.

CurrentWindow(currentFontOnly=False)

Get the current font related window. Can be either a FontWindow, GlyphWindow, SpaceCenter or a SingleFontWindow.

currentFontOnly
Optionally only return the window for the current font.

UpdateCurrentGlyphView()

Update the current glyph view.

OutputWindow()

The output window. use outputWindow.clear() to empty it.

SetCurrentGlyphByName(glyphName)

Set the current glyph by glyph name in the current glyph view.

SetCurrentLayerByName(layerName)

Set the current layer by layer name.

OpenGlyphWindow(glyph=None, newWindow=False)

Open a glyph window with a given glyph. Optionally add newWindow=True to open a new glyph window.

glyph
Optionally provide a glyph object to set in the glyph window.
newWindow
Optionally force opening a new window, even if there is already one open.

OpenSpaceCenter(font, newWindow=False)

Open a Space Center for a given font. Optionally add newWindow=True to open a new Space Center.

font
Optionally provide a font object to set in the space center.
newWindow
Optionally force opening a new window, even if there is already one open.

OpenFontInfoSheet(font, parentWindow=None)

Open a font info sheet of the a given font.

font
Optionally provide a font object to set in the info sheet.
parentWindow
Optionally attache the info sheet to a specific parent window. As default it is attached to the main window.

OpenScriptWindow(path)

Open a .py path in a scripting window.

path
The path to the .py file to open.

addSmartSet(smartSet, index=None)

Add a smart set object.

index
Optionallly insert the given smart set at an index.

removeSmartSet(smartSetName)

Remove a smart set by name.

getSmartSets()

Return a list of all current smart sets.

updateAllSmartSets(selection=None)

Update the ui for a smartset list in all open font windows.

selectSmartSets(selection, currentDocumentOnly=True)

Selecte a smart set by selection a list of indexes.

currentDocumentOnly
Optionally apply it to all open documents.

setDefaultCharacterSet(characterSetName)

Set the default character set by name as defined in the preferences.

getDefaultCharacterSet()

Return the current default character set name.

addCharacterSet(characterSetName, glyphNames, useAsDefault=False)

Add a character set with a characterSetName and a list of glyphNames.

useAsDefault
Optionally set a bool indicating if the new characterSetName is the default characenterset name.

removeCharacterSet(characterSetName)

Remove a character set by name.

getCharacterSets()

Return all character sets as a dictionary.

setCharacterSets(characterSets)

Set a dictionary of character sets.

setMaxAmountOfVisibleTools(value)

Set the maximum amount of visible tools in the toolbar.

getMaxAmountOfVisibleTools()

Return the maximum amount of visible tools in the toolbar.

createModifier(command=False, shift=False, control=False, alternate=False)

Return a modifier.

shortKeyExists(shortKey)

Returns a bool True when a shortKey exist in the app menu.

exportPreferences(path=None)

Export all user preferences to a path. When path is `None is given it returns a dictionary with all the preferences.

importPreferences(pathOrObject)

Import user preferences from a path or dictionary object.

getTestInstalledFonts()

Return all fonts which are test installed.

testDeinstallFont(font)

Deinstall a provided font.

getDefault(key, defaultValue=None, defaultClass=None)

setDefault(key, value)

removeDefault(key)

setPassword(service, username, password)

getPassword(service, username)

deletePassword(service, username)

dontShowAgainMessage(messageText='', informativeText='', alertStyle=1, parentWindow=None, resultCallback=None, dontShowAgainKey='')

Show a dialog with a ‘Don’t Show Again’ option.

messageText
The message to be displayed in the dialog.
informativeText
The inforamtive text to be displayed in the dialog.
alertStyle
Optionally provide an alert style see NSAlertStyle
parentWindow
Optionally provide a window object, must be a vanilla or NSWindow object.
resultCallback
The callback return the user input.
dontShowAgainKey
The key to store the result, if the key is available the dialog will not pop up. Must a reverse domain key: com.example.myTool.action

dontShowAgainYesOrNo(messageText='', informativeText='', alertStyle=1, parentWindow=None, resultCallback=None, buttons=[], dontShowAgainKey='')

Show a Yes or No dialog with a ‘Don’t Show Again’ option.

messageText
The message to be displayed in the dialog.
informativeText
The inforamtive text to be displayed in the dialog.
alertStyle
Optionally provide an alert style see NSAlertStyle
parentWindow
Optionally provide a window object, must be a vanilla or NSWindow object.
resultCallback
The callback return the user input.
buttons
Optionally provide a list of button titles, defaults are Yes, No, Don't show this message again.
dontShowAgainKey
The key to store the result, if the key is available the dialog will not pop up. Must a reverse domain key: com.example.myTool.action

AskString(message, value='', title='FontParts')

An ask a string dialog, a message is required. Optionally a value and title can be provided.

from mojo.UI import AskString
print(AskString("who are you?"))

AskYesNoCancel(message, title='FontParts', default=0, informativeText='')

An ask yes, no or cancel dialog, a message is required. Optionally a title, default and informativeText can be provided. The default option is to indicate which button is the default button.

from mojo.UI import AskYesNoCancel
print(AskYesNoCancel("who are you?"))

FindGlyph(aFont, message='Search for a glyph:', title='FontParts')

A dialog to search a glyph for a provided font. Optionally a message, title and allFonts can be provided.

from mojo.UI import FindGlyph
glyph = FindGlyph(CurrentFont())
print(glyph)

GetFile(message=None, title=None, directory=None, fileName=None, allowsMultipleSelection=False, fileTypes=None)

An get file dialog. Optionally a message, title, directory, fileName and allowsMultipleSelection can be provided.

from mojo.UI import GetFile
print(GetFile())

GetFileOrFolder(message=None, title=None, directory=None, fileName=None, allowsMultipleSelection=False, fileTypes=None)

An get file or folder dialog. Optionally a message, title, directory, fileName, allowsMultipleSelection and fileTypes can be provided.

from mojo.UI import GetFileOrFolder
print(GetFileOrFolder())

GetFolder(message=None, title=None, directory=None, allowsMultipleSelection=False)

An get folder dialog. Optionally a message, title, directory and allowsMultipleSelection can be provided.

from mojo.UI import GetFolder
print(GetFolder())

Message(message, title='FontParts', informativeText='')

An message dialog. Optionally a message, title and informativeText can be provided.

from mojo.UI import Message
print(Message("This is a message"))

PutFile(message=None, fileName=None)

An put file dialog. Optionally a message and fileName can be provided.

from mojo.UI import PutFile
print(PutFile())

SearchList(items, message='Select an item:', title='FontParts')

A dialgo to search a given list. Optionally a message, title and allFonts can be provided.

from mojo.UI import SearchList
result = SearchList(["a", "b", "c"])
print(result)

SelectFont(message='Select a font:', title='FontParts', allFonts=None)

Select a font from all open fonts. Optionally a message, title and allFonts can be provided. If allFonts is None it will list all open fonts.

from mojo.UI import SelectFont
font = SelectFont()
print(font)

SelectGlyph(aFont, message='Select a glyph:', title='FontParts')

Select a glyph for a given font. Optionally a message and title can be provided.

from mojo.UI import SelectGlyph
font = CurrentFont()
glyph = SelectGlyph(font)
print(glyph)

getScriptingMenuNamingShortKey()

setScriptingMenuNamingShortKey(data)

setScriptingMenuNamingShortKeyForPath(path, preferredName, shortKey='', modifier=None)

removeScriptingMenuNamingShortKeyForPath(path)

class HelpWindow()

Open a help window with a html file.

htmlPath
path to html file to set in the HTMLView of the HelpWindow
htmlString
string containing html to set in the HTMLView of the HelpWindow
title
title of the help window
developer
a string with the name of the developer, optionally
developerURL
a URL link to the developer, optionally

from mojo.UI import HelpWindow

HelpWindow(“http://robofont.com”)

Inherits from subclass: mojo.UI.HelpWindow

reload()

Reload the Help Window.

setHTML(html)

Set html string for the Help Window.

setHTMLPath(htmlPath)

Set the html path for the Help Window.

class HTMLView()

A vanilla browser object.

posSize

a tuple of four, setting the size

clearHistory()

Clear HTMLView history.

goBack()

Go backward in the history of the HTMLView.

goForward()

Go forward in the history of the HTMLView.

setFrameDelegate(delegate)

Set a frame delegate.

Inherits from subclass: vanilla.vanillaGroup.Group

class CodeEditor()

Code editor control.::

from vanilla import Window
from mojo.UI import CodeEditor

class CodeEditorDemo(object):

    def __init__(self):
        self.w = Window((200, 200))
        self.w.codeEditor = CodeEditor((10, 10, -10, -10),
                            callback=self.codeEditorCallback,
                            showLineNumbers=True)
        self.w.open()

    def codeEditorCallback(self, sender):
        print("text entry!", sender.get())

CodeEditorDemo()

posSize Tuple of form (left, top, width, height) representing the position and size of the text entry control.

text The text to be displayed in the text entry control.

lexer A pygements lexer: `from pygments.lexers import PythonLexer

usesTabs Boolean representing if the ediotor should use tabs.

indentSize The amount of indent.

showLineNumbers Boolean representing to showing line numbers

callback The method to be called when the user presses the text entry control.

readOnly Boolean representing if the text can be edited or not.

checksSpelling Boolean representing if spelling should be automatically checked or not.

comment()

dedent()

hasLineNumbers()

indent()

indentSize()

jumpToLine(lineNumber=None)

setHighlightStyle(style)

setIndentSize(value)

setLanguagesIDEBehavior(languagesIDEBehavior)

setLexer(lexer)

setUsesTabs(value)

showLineNumbers(value)

toggleLineNumbers()

uncomment()

usesTabs()

wrapWord(value)

Inherits from subclass: vanilla.vanillaTextEditor.TextEditor

get()

Get the contents of the text entry control.

getNSTextView()

Return the NSTextView that this object wraps.

selectAll()

Select all text in the text entry control.

set(value)

Set the contents of the text box.

value A string representing the contents of the text box.

class AccordionView()

A vanilla object hosting different kinds of other vanilla objects (like vanilla.List, vanilla.TextEditor, ….) in an accordion view.

posSize

a tuple of four, setting the size

descriptions

list of options for each item in the accordionView (see example)

backgroundColor

a NSColor object used as background color

from mojo.UI import AccordionView
from vanilla import *

class MyInspector:

    def __init__(self):

        self.w = FloatingWindow((200, 600))

        self.firstItem = TextEditor((10, 10, -10, -10))

        self.secondItem = List((0, 0, -0, -0), ["a", "b", "c"])

        self.thirdItem = Tabs((10, 10, -10, -10), ["1", "2", "3"])

        self.fourthItem = Group((0, 0, -0, -0))

        self.fourthItem.checkBox = CheckBox((10, 10, 100, 22), "CheckBox")
        self.fourthItem.editText = EditText((10, 40, -10, 22))


        descriptions = [
                       dict(label="first item", view=self.firstItem, size=200, collapsed=False, canResize=False),
                       dict(label="second item", view=self.secondItem, minSize=100, size=140, collapsed=True, canResize=True),
                       dict(label="third item", view=self.thirdItem, minSize=100, size=140, collapsed=True, canResize=False),
                       dict(label="fourth item", view=self.fourthItem, size=140, collapsed=False, canResize=False)
                       ]

        self.w.accordionView = AccordionView((0, 0, -0, -0), descriptions)

        self.w.open()

MyInspector()
Inherits from subclass: vanilla.vanillaScrollView.ScrollView

setBackgroundColor(color)

Set the background of the scrol view to color.

class SmartSet()

A smart set object.

Inherits from subclass: mojo.UI.SmartSet

glyphNames

A list of glyph names.

groups

Return a list of all smart sets inside a group item.

name

Name of the smart set.

query

Search query of the smart set.

addGroupSmartSet(smartSet)

Add a provided smartSet in a smart set group item.

getQueryObject()

Return the query as a NSPredicate object.

isGroup()

Return a bool when the smart set is a group item.

removeGroupSmartSet(smartSet)

Remove the provided smartSet from a smart set group item.

removeGroups()

Remove all groups in the group item.

class MultiLineView()

A multi glyph line view vanilla object, this is the same objects that is used to build a Space Center. Initiate a multi line view object:

posSize
a tuple of four, setting the size
pointSize
the initial point size, optionally
lineHeight
the initial lineHeight, , optionally
doubleClickCallback
callback for a double click event
applyKerning
enable kerning the view, optionally
bordered
set a border around the view
hasHorizontalScroller
set the horizontal scroller
hasVerticalScroller
set the vertical scroller
displayOptions
a dict with multi line view display options
selectionCallback
callback when a glyph get selected
menuForEventCallback
callback when a contextual menu will we used, required to return a NSMenu object
from mojo.UI import MultiLineView
from vanilla import *

class MyOwnSpaceCenter:

    def __init__(self, font):

        self.w = Window((600, 400), minSize=(300, 300))

        self.w.lineView = MultiLineView((0, 0, -0, -0),
                                            pointSize=30,
                                            selectionCallback=self.lineViewSelectionCallback)
        self.w.lineView.setFont(font)

        glyphs = []
        for glyphName in font.glyphOrder:
            glyphs.append(font[glyphName])

        self.w.lineView.set(glyphs)

        self.w.open()

    def lineViewSelectionCallback(self, sender):
        print(sender.getSelectedGlyph())

MyOwnSpaceCenter(CurrentFont())
Inherits from subclass: mojo.UI.MultiLineView

createEmptyGlyph(name=None)

Return a special empty glyph.

createNewLineGlyph()

Return a special new line glyph.

getSelectedGlyph()

Return the selected glyph.

setCanSelect(value)

Set a bool to indicate if a line view can select glyphs.

setFont(font)

The glyph line view needs a font as fallback and for font metrics

update()

Update the glyph line view.

canAutoScale()

Return if the view can auto scale

disableDrag(value)

Disable dragging.

getDisplayStates()

Return current display states.

getFont()

Return the font form the glyph line view.

getLayer()

getLeftToRight()

Return the current writing direction as a left to right bool.

getLineHeight()

Return the current line height

getPointSize()

Return the current point size.

getSelected()

Return the selected glyph

getSelectedGlyphRecord()

Return the selected glyph record

getSelection()

Return the selected index.

getTracking()

Return the current tracking.

isFirstResponder()

Return of the line view is the first responder.

setApplyKerning(value)

Set apply kerning.

setCenter(center)

Get the parent space center.

setDisplayMode(mode)

Set a display mode.

setDisplayStates(displayOptions)

Set display states.

setKerningInGlyphRecords(glyphRecords)

Apply kerning in given glyph records.

setLayer(layer)

setLeftToRight(value)

Set writing direction left to right as a bool.

setLineHeight(value)

Set the line height.

setPointSize(pointSize)

Set the point size.

setSelectedGlyphRecord(glyphRecord)

Set the selected glyph record.

setSelection(index)

Set a selection index.

setTracking(value)

Set tracking.

class SpaceMatrix()

A space matrix view vanilla object.

from mojo.UI import MultiLineView, SpaceMatrix

from vanilla import *

class Controller:

    def __init__(self):

        self.w = Window((400, 400))

        self.w.lineView = MultiLineView((0, 0, -0, -48))
        self.w.hl = HorizontalLine((0, -(48+1), -0, 1))
        self.w.matrix = SpaceMatrix((0, -48, -0, -0), callback=self._matrixCallback)

        f = CurrentFont()

        glyphs = [f["A"], f["a"]]

        self.w.lineView.set(glyphs)
        self.w.matrix.set(glyphs)
        self.w.open()

    def _matrixCallback(self, sender):
        self.w.lineView.update()

Controller()
Inherits from subclass: mojo.UI.SpaceMatrix

getShowPreAfterGlyphs()

Get show pre and after glyphs.

getShowTemplateGlyphs()

Get show template glyphs.

setBeamPosition(value)

Set beam position.

setShowBeam(value)

Set show beam as a bool.

setShowPreAfterGlyphs(value)

Set show pre and after glypsh as a bool.

setShowTemplateGlyphs(value)

Set show template glyphs as a bool.

setSpaceCenter(spaceCenter)

Set a parent space center.

class KernCenter()

A Kerning view vanilla object for a given font.

parentWindow
Optionally provide a parentWindow to attach the sheet to.
Inherits from subclass: mojo.UI.KernCenter

lineViewSelectionCallback(selection)

class GroupCenter()

A Groups view vanilla object for a givenfont.

parentWindow
Optionally provide a parentWindow to attach the sheet to.
Inherits from subclass: mojo.UI.GroupCenter

class MenuBuilder()

Build a menu from a list sturucture.

[
    NSMenuItem,
    ("title", callback),
    ("title", [
            ("sub menu title", callback),
        ])
]
title
Optionally provide a title.
Inherits from subclass: mojo.UI.MenuBuilder

pyobjc_ISA

pyobjc_instanceMethods

open(event, view)

Open the menu for an event in a view.

buildAdditionContextualMenuItems(menu, additionContextualMenuItems, insert=None)

getMenu()

Return the menu.

class DoodleWindow()

A window capable of containing controls.

To add a control to a window, simply set it as an attribute of the window.::

from vanilla import *

class WindowDemo(object):

    def __init__(self):
        self.w = Window((200, 70), "Window Demo")
        self.w.myButton = Button((10, 10, -10, 20), "My Button")
        self.w.myTextBox = TextBox((10, 40, -10, 17), "My Text Box")
        self.w.open()

WindowDemo()

No special naming is required for the attributes. However, each attribute must have a unique name.

posSize Tuple of form (left, top, width, height) representing the position and size of the window. It may also be a tuple of form (width, height). In this case, the window will be positioned on screen automatically.

title The title to be set in the title bar of the window.

minSize Tuple of the form (width, height) representing the minimum size that the window can be resized to.

maxSize Tuple of the form (width, height) representing the maximum size that the window can be resized to.

textured Boolean value representing if the window should have a textured appearance or not.

autosaveName A string representing a unique name for the window. If given, this name will be used to store the window position and size in the application preferences.

closable Boolean value representing if the window should have a close button in the title bar.

miniaturizable Boolean value representing if the window should have a minimize button in the title bar.

initiallyVisible Boolean value representing if the window will be initially visible. Default is True. If False, you can show the window later by calling window.show().

fullScreenMode An indication of the full screen mode. These are the options:

+—————+—————————————————————+ | None | The window does not allow full screen. | +—————+—————————————————————+ | “primary” | Corresponds to NSWindowCollectionBehaviorFullScreenPrimary. | +—————+—————————————————————+ | “auxiliary” | Corresponds to NSWindowCollectionBehaviorFullScreenAuxiliary. | +—————+—————————————————————+

titleVisible Boolean value indicating if the window title should be displayed.

fullSizeContentView Boolean value indicating if the content view should be the full size of the window, including the area underneath the titlebar and toolbar.

screen A NSScreen <http://tinyurl.com/NSScreen>_ object indicating the screen that the window should be drawn to. When None the window will be drawn to the main screen.

Inherits from subclass: builtins.objc.objc_class

class StatusInteractivePopUpWindow()

A window capable of containing controls.

To add a control to a window, simply set it as an attribute of the window.::

from vanilla import *

class WindowDemo(object):

    def __init__(self):
        self.w = Window((200, 70), "Window Demo")
        self.w.myButton = Button((10, 10, -10, 20), "My Button")
        self.w.myTextBox = TextBox((10, 40, -10, 17), "My Text Box")
        self.w.open()

WindowDemo()

No special naming is required for the attributes. However, each attribute must have a unique name.

posSize Tuple of form (left, top, width, height) representing the position and size of the window. It may also be a tuple of form (width, height). In this case, the window will be positioned on screen automatically.

title The title to be set in the title bar of the window.

minSize Tuple of the form (width, height) representing the minimum size that the window can be resized to.

maxSize Tuple of the form (width, height) representing the maximum size that the window can be resized to.

textured Boolean value representing if the window should have a textured appearance or not.

autosaveName A string representing a unique name for the window. If given, this name will be used to store the window position and size in the application preferences.

closable Boolean value representing if the window should have a close button in the title bar.

miniaturizable Boolean value representing if the window should have a minimize button in the title bar.

initiallyVisible Boolean value representing if the window will be initially visible. Default is True. If False, you can show the window later by calling window.show().

fullScreenMode An indication of the full screen mode. These are the options:

+—————+—————————————————————+ | None | The window does not allow full screen. | +—————+—————————————————————+ | “primary” | Corresponds to NSWindowCollectionBehaviorFullScreenPrimary. | +—————+—————————————————————+ | “auxiliary” | Corresponds to NSWindowCollectionBehaviorFullScreenAuxiliary. | +—————+—————————————————————+

titleVisible Boolean value indicating if the window title should be displayed.

fullSizeContentView Boolean value indicating if the content view should be the full size of the window, including the area underneath the titlebar and toolbar.

screen A NSScreen <http://tinyurl.com/NSScreen>_ object indicating the screen that the window should be drawn to. When None the window will be drawn to the main screen.

close()

windowDeselectCallback_()

Inherits from subclass: builtins.objc.objc_class

class ScrollToFirstResponderWindow()

A window capable of containing controls.

To add a control to a window, simply set it as an attribute of the window.::

from vanilla import *

class WindowDemo(object):

    def __init__(self):
        self.w = Window((200, 70), "Window Demo")
        self.w.myButton = Button((10, 10, -10, 20), "My Button")
        self.w.myTextBox = TextBox((10, 40, -10, 17), "My Text Box")
        self.w.open()

WindowDemo()

No special naming is required for the attributes. However, each attribute must have a unique name.

posSize Tuple of form (left, top, width, height) representing the position and size of the window. It may also be a tuple of form (width, height). In this case, the window will be positioned on screen automatically.

title The title to be set in the title bar of the window.

minSize Tuple of the form (width, height) representing the minimum size that the window can be resized to.

maxSize Tuple of the form (width, height) representing the maximum size that the window can be resized to.

textured Boolean value representing if the window should have a textured appearance or not.

autosaveName A string representing a unique name for the window. If given, this name will be used to store the window position and size in the application preferences.

closable Boolean value representing if the window should have a close button in the title bar.

miniaturizable Boolean value representing if the window should have a minimize button in the title bar.

initiallyVisible Boolean value representing if the window will be initially visible. Default is True. If False, you can show the window later by calling window.show().

fullScreenMode An indication of the full screen mode. These are the options:

+—————+—————————————————————+ | None | The window does not allow full screen. | +—————+—————————————————————+ | “primary” | Corresponds to NSWindowCollectionBehaviorFullScreenPrimary. | +—————+—————————————————————+ | “auxiliary” | Corresponds to NSWindowCollectionBehaviorFullScreenAuxiliary. | +—————+—————————————————————+

titleVisible Boolean value indicating if the window title should be displayed.

fullSizeContentView Boolean value indicating if the content view should be the full size of the window, including the area underneath the titlebar and toolbar.

screen A NSScreen <http://tinyurl.com/NSScreen>_ object indicating the screen that the window should be drawn to. When None the window will be drawn to the main screen.

Inherits from subclass: builtins.objc.objc_class

class ScrollToFirstResponderSheet()

A window that is attached to another window.

To add a control to a sheet, simply set it as an attribute of the sheet.::

from vanilla import *

class SheetDemo(object):

    def __init__(self, parentWindow):
        self.w = Sheet((200, 70), parentWindow)
        self.w.myButton = Button((10, 10, -10, 20), "My Button")
        self.w.myTextBox = TextBox((10, 40, -10, 17), "My Text Box")
        self.w.open()

SheetDemo()

No special naming is required for the attributes. However, each attribute must have a unique name.

posSize Tuple of form (width, height) representing the size of the sheet.

parentWindow The window that the sheet should be attached to.

minSize Tuple of the form (width, height) representing the minimum size that the sheet can be resized to.

maxSize Tuple of the form (width, height) representing the maximum size that the sheet can be resized to.

autosaveName A string representing a unique name for the sheet. If given, this name will be used to store the sheet size in the application preferences.

Inherits from subclass: vanilla.vanillaWindows.Sheet

class ModalWindow()

A window capable of containing controls.

To add a control to a window, simply set it as an attribute of the window.::

from vanilla import *

class WindowDemo(object):

    def __init__(self):
        self.w = Window((200, 70), "Window Demo")
        self.w.myButton = Button((10, 10, -10, 20), "My Button")
        self.w.myTextBox = TextBox((10, 40, -10, 17), "My Text Box")
        self.w.open()

WindowDemo()

No special naming is required for the attributes. However, each attribute must have a unique name.

posSize Tuple of form (left, top, width, height) representing the position and size of the window. It may also be a tuple of form (width, height). In this case, the window will be positioned on screen automatically.

title The title to be set in the title bar of the window.

minSize Tuple of the form (width, height) representing the minimum size that the window can be resized to.

maxSize Tuple of the form (width, height) representing the maximum size that the window can be resized to.

textured Boolean value representing if the window should have a textured appearance or not.

autosaveName A string representing a unique name for the window. If given, this name will be used to store the window position and size in the application preferences.

closable Boolean value representing if the window should have a close button in the title bar.

miniaturizable Boolean value representing if the window should have a minimize button in the title bar.

initiallyVisible Boolean value representing if the window will be initially visible. Default is True. If False, you can show the window later by calling window.show().

fullScreenMode An indication of the full screen mode. These are the options:

+—————+—————————————————————+ | None | The window does not allow full screen. | +—————+—————————————————————+ | “primary” | Corresponds to NSWindowCollectionBehaviorFullScreenPrimary. | +—————+—————————————————————+ | “auxiliary” | Corresponds to NSWindowCollectionBehaviorFullScreenAuxiliary. | +—————+—————————————————————+

titleVisible Boolean value indicating if the window title should be displayed.

fullSizeContentView Boolean value indicating if the content view should be the full size of the window, including the area underneath the titlebar and toolbar.

screen A NSScreen <http://tinyurl.com/NSScreen>_ object indicating the screen that the window should be drawn to. When None the window will be drawn to the main screen.

Inherits from subclass: builtins.objc.objc_class

class ShowHideFloatingWindow()

A window that floats above all other windows.

To add a control to a window, simply set it as an attribute of the window.::

from vanilla import *

class FloatingWindowDemo(object):

    def __init__(self):
        self.w = FloatingWindow((200, 70), "FloatingWindow Demo")
        self.w.myButton = Button((10, 10, -10, 20), "My Button")
        self.w.myTextBox = TextBox((10, 40, -10, 17), "My Text Box")
        self.w.open()

FloatingWindowDemo()

No special naming is required for the attributes. However, each attribute must have a unique name.

posSize Tuple of form (left, top, width, height) representing the position and size of the window. It may also be a tuple of form (width, height). In this case, the window will be positioned on screen automatically.

title The title to be set in the title bar of the window.

minSize Tuple of the form (width, height) representing the minimum size that the window can be resized to.

maxSize Tuple of the form (width, height) representing the maximum size that the window can be resized to.

textured Boolean value representing if the window should have a textured appearance or not.

autosaveName A string representing a unique name for the window. If given, this name will be used to store the window position and size in the application preferences.

closable Boolean value representing if the window should have a close button in the title bar.

screen A NSScreen <http://tinyurl.com/NSScreen>_ object indicating the screen that the window should be drawn to. When None the window will be drawn to the main screen.

Inherits from subclass: vanilla.vanillaWindows.FloatingWindow

show()

Show the window if it is hidden.

class ShowHideWindow()

A window capable of containing controls.

To add a control to a window, simply set it as an attribute of the window.::

from vanilla import *

class WindowDemo(object):

    def __init__(self):
        self.w = Window((200, 70), "Window Demo")
        self.w.myButton = Button((10, 10, -10, 20), "My Button")
        self.w.myTextBox = TextBox((10, 40, -10, 17), "My Text Box")
        self.w.open()

WindowDemo()

No special naming is required for the attributes. However, each attribute must have a unique name.

posSize Tuple of form (left, top, width, height) representing the position and size of the window. It may also be a tuple of form (width, height). In this case, the window will be positioned on screen automatically.

title The title to be set in the title bar of the window.

minSize Tuple of the form (width, height) representing the minimum size that the window can be resized to.

maxSize Tuple of the form (width, height) representing the maximum size that the window can be resized to.

textured Boolean value representing if the window should have a textured appearance or not.

autosaveName A string representing a unique name for the window. If given, this name will be used to store the window position and size in the application preferences.

closable Boolean value representing if the window should have a close button in the title bar.

miniaturizable Boolean value representing if the window should have a minimize button in the title bar.

initiallyVisible Boolean value representing if the window will be initially visible. Default is True. If False, you can show the window later by calling window.show().

fullScreenMode An indication of the full screen mode. These are the options:

+—————+—————————————————————+ | None | The window does not allow full screen. | +—————+—————————————————————+ | “primary” | Corresponds to NSWindowCollectionBehaviorFullScreenPrimary. | +—————+—————————————————————+ | “auxiliary” | Corresponds to NSWindowCollectionBehaviorFullScreenAuxiliary. | +—————+—————————————————————+

titleVisible Boolean value indicating if the window title should be displayed.

fullSizeContentView Boolean value indicating if the content view should be the full size of the window, including the area underneath the titlebar and toolbar.

screen A NSScreen <http://tinyurl.com/NSScreen>_ object indicating the screen that the window should be drawn to. When None the window will be drawn to the main screen.

Inherits from subclass: builtins.objc.objc_class

class EditStepper()

A vanilla object to edit a value with stepper.

enable(value)

Enable the stepper.

Inherits from subclass: vanilla.vanillaGroup.Group

class EditIntStepper()

A vanilla object to edit a value with stepper.

Inherits from subclass: vanilla.vanillaGroup.Group

class SliderEditStepper()

A vanilla object to edit a value with stepper and a slider.

Inherits from subclass: vanilla.vanillaGroup.Group

class SliderEditIntStepper()

A vanilla object to edit a value with stepper and a slider.

Inherits from subclass: vanilla.vanillaGroup.Group

class ProgressBar()

A progess bar dialog. Optionally a title, ticks and label can be provided.

from mojo.UI import ProgressBar

bar = ProgressBar()
# do something
bar.close()
Inherits from subclass: mojo.UI.ProgressBar

getCurrentTick()

Return the current tick state.

label(label)

Set the label for the progress bar.

tick(tickValue=None)

Increment the tick value. Optionally a tickValue can be provided to set the tick count.

Last edited on 15/06/2018