Box

class vanilla.Box(posSize, title=None)

A bordered container for other controls.

To add a control to a box, simply set it as an attribute of the box.:

from vanilla import *

class BoxDemo(object):

    def __init__(self):
        self.w = Window((150, 70))
        self.w.box = Box((10, 10, -10, -10))
        self.w.box.text = TextBox((10, 10, -10, -10), "This is a box")
        self.w.open()

BoxDemo()

No special naming is required for the attributes. However, each attribute must have a unique name.

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

title The title to be displayed dabove the box. Pass None if no title is desired.

getNSBox()

Return the NSBox that this object wraps.

setTitle(title)

Set the title of the box.

getTitle()

Get the title of the 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).

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

show(onOff)

Show or hide the object.

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