PopUpButton

class vanilla.PopUpButton(posSize, items, callback=None, sizeStyle='regular')

A button which, when selected, displays a list of items for the user to choose from.:

from vanilla import *

class PopUpButtonDemo(object):

    def __init__(self):
        self.w = Window((100, 40))
        self.w.popUpButton = PopUpButton((10, 10, -10, 20),
                              ["A", "B", "C"],
                              callback=self.popUpButtonCallback)
        self.w.open()

    def popUpButtonCallback(self, sender):
        print "pop up button selection!", sender.get()

PopUpButtonDemo()

posSize Tuple of form (left, top, width, height) representing the position and size of the pop up button. The size of the button sould match the appropriate value for the given sizeStyle.

Standard Dimensions
Regular H 20
Small H 17
Mini H 15

items A list of items to appear in the pop up list.

callback The method to be called when the user selects an item in the pop up list.

sizeStyle A string representing the desired size style of the pop up button. The options are:

“regular”
“small”
“mini”
getNSPopUpButton()

Return the NSPopUpButton that this object wraps.

get()

Get the index selected item in the pop up list.

set(value)

Set the index of the selected item in the pop up list.

setItems(items)

Set the items to appear in the pop up list.

getItems()

Get the list of items that appear in the pop up list.

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.