class vanilla.SearchBox(posSize, text='', callback=None, formatter=None, placeholder=None, sizeStyle='regular')

A text entry field similar to the search field in Safari.:

from vanilla import *

class SearchBoxDemo(object):

    def __init__(self):
        self.w = Window((100, 42))
        self.w.searchBox = SearchBox((10, 10, -10, 22),

    def searchBoxCallback(self, sender):
        print "search box entry!", sender.get()


posSize Tuple of form (left, top, width, height) representing the position and size of the search box.

Standard Dimensions
Regular H 22
Small H 19
Mini H 15

text The text to be displayed in the search box.

callback The method to be called when the user presses the search box.

formatter A NSFormatter for controlling the display and input of the text entry.

placeholder A placeholder string to be shown when the text entry control is empty.

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


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


Get the contents of the search box.


Return the NSSearchField that this object wraps.


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 contents of the search box.

value A string representing the contents of the search box.


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.