ColorWell

class vanilla.ColorWell(posSize, callback=None, color=None)

A control that allows for showing and choosing a color value.

ColorWell objects handle NSColor objects.:

from AppKit import NSColor
from vanilla import *

class ColorWellDemo(object):

    def __init__(self):
        self.w = Window((100, 50))
        self.w.colorWell = ColorWell((10, 10, -10, -10),
                            callback=self.colorWellEdit,
                            color=NSColor.redColor())
        self.w.open()

    def colorWellEdit(self, sender):
        print "color well edit!", sender.get()

ColorWellDemo()

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

callback The method to be caled when the user selects a new color.

color A NSColor object. If None is given, the color shown will be white.

enable(onOff)

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

get()

Get the NSColor object representing the current color in the color well.

getNSColorWell()

Return the NSColorWell that this object wraps.

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.

set(color)

Set the color in the color well.

color A NSColor object representing the color to be displayed in the color well.

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.