What is vanilla?

vanilla is Python wrapper around Apple’s native Cocoa UI layer. It offers a pythonicIdiomatic Python. Code that doesn’t just get the syntax right, but also follows the conventions of the Python community and uses the language in the way it is intended to be used. API for creating interfaces with code, rather than using visual tools like Apple’s Interface Builder. vanilla was developed by Tal Leming, and was inspired by the classic WA Python wrapper around the native UI layer of Classic MacOS. library used by RoboFogA fork of Fontographer with a built-in Python interpreter..

How to use vanilla

vanilla is embedded in RoboFont, so you can start using it in your scripts right away:

from vanilla import *

vanilla has a very complete documentation which is available directly from your scripting environment:

from vanilla import Window

The above snippet will return the provided documentation for the Window object, including some sample code:

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")


Run the sample code to open a demo window:

Widgets overview

Below is an overview of the UI elements included in vanilla. These images are screenshots from vanilla’s own test files, which are included in the library.

from vanilla.test.testAll import Test
Last edited on 21/02/2019