CheckBox

class vanilla.CheckBox(posSize, title, callback=None, value=False, sizeStyle='regular')

A standard check box.:

from vanilla import *

class CheckBoxDemo(object):

    def __init__(self):
        self.w = Window((100, 40))
        self.w.checkBox = CheckBox((10, 10, -10, 20), "A CheckBox",
                           callback=self.checkBoxCallback, value=True)
        self.w.open()

    def checkBoxCallback(self, sender):
        print "check box state change!", sender.get()

CheckBoxDemo()

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

Standard Dimensions
Regular H 22
Small H 18
Mini H 10

title The text to be displayed next to the check box. Pass None is no title is desired.

callback The method to be called when the user changes the state of the check box.

value A boolean representing the state of the check box.

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

“regular”
“small”
“mini”
enable(onOff)

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

get()

Get the state of the check box.

getNSButton()

Return the NSButton that this object wraps.

This is currently not implemented for CheckBox.

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.

set(value)

Set the state of the check box.

value A boolean representing the state of the check box.

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.

toggle()

Toggle the state of the check box.

If the check box is on, turn it off. If the check box is off, turn it on.