SearchBox

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),
                                callback=self.searchBoxCallback)
        self.w.open()

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

SearchBoxDemo()

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:

“regular”
“small”
“mini”
getNSSearchField()

Return the NSSearchField that this object wraps.

get()

Get the contents of the search box.

set(value)

Set the contents of the search box.

value A string representing the contents of the search box.

enable(onOff)

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

getPosSize()

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

getTitle()

Get the control title.

isVisible()

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.

setPosSize(posSize)

Set the postion and size of the object.

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

setTitle(title)

Set the control title.

title A string representing the title.

show(onOff)

Show or hide the object.

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