class vanilla.Button(posSize, title, callback=None, sizeStyle='regular')

A standard button.:

from vanilla import *

class ButtonDemo(object):

     def __init__(self):
         self.w = Window((100, 40))
         self.w.button = Button((10, 10, -10, 20), "A Button",

     def buttonCallback(self, sender):
         print "button hit!"


posSize Tuple of form (left, top, width, height) representing the position and size of the button. The size of the button sould match the appropriate value for the given sizeStyle.

Standard Dimensions
Regular H 20
Small H 17
Mini H 14

title The text to be displayed on the button. Pass None is no title is desired.

callback The method to be called when the user presses the button.

sizeStyle A string representing the desired size style of the button. The options are:


Return the NSButton that this object wraps.

bind(key, modifiers)

Bind a key to the button.

key A single character or one of the following:


modifiers A list containing nothing or as many of the following as desired:


Enable or disable the object. onOff should be a boolean.


The position and size of the object as a tuple of form (left, top, width, height).


Get the control title.


Return a bool indicting if the object is visible or not.

move(x, y)

Move the object by x units and y units.

resize(width, height)

Change the size of the object to width and height.


Set the postion and size of the object.

posSize A tuple of form (left, top, width, height).


Set the control title.

title A string representing the title.


Show or hide the object.

onOff A boolean value representing if the object should be shown or not.