What is vanilla?
vanilla is a Python wrapper around the macOS native Cocoa user interface 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 own Interface Builder.
vanilla was developed by Tal Leming, inspired by the classic WA Python wrapper around the native UI layer of Classic MacOS. library used in RoboFogA fork of Fontographer with a built-in Python interpreter..
A wide array of tools are created with vanilla, from small scripts to extensions and applications. RoboFont itself is built using vanilla.
vanilla is embedded in RoboFont, so you can start using it right away in your scripts:
from vanilla import *
vanilla has a very complete documentation which is available directly from your scripting environment:
from vanilla import Window help(Window)
The above snippet will return the provided documentation for the
Window object, including some sample code:
from vanilla import * class WindowDemo: 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()
Run the sample code to open a demo window:
The screenshots below give an overview of the UI elements included in vanilla. These images are produced using vanilla’s own test files, which are included in the module.
from vanilla.test.testAll import Test Test()