RadioGroup

class vanilla.RadioGroup(posSize, titles, isVertical=True, callback=None, sizeStyle='regular')

A collection of radio buttons.:

from vanilla import *

class RadioGroupDemo(object):

    def __init__(self):
        self.w = Window((100, 60))
        self.w.radioGroup = RadioGroup((10, 10, -10, 40),
                                ["Option 1", "Option 2"],
                                callback=self.radioGroupCallback)
        self.w.open()

    def radioGroupCallback(self, sender):
        print "radio group edit!", sender.get()

RadioGroupDemo()

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

titles A list of titles to be shown next to the radio buttons.

isVertical Boolean representing if the radio group is vertical or horizontal.

callback The method to be caled when a radio button is selected.

sizeStyle A string representing the desired size style of the radio group. The options are:

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

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

get()

Get the index of the selected radio button.

getNSMatrix()

Return the NSMatrix that this object wraps.

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(index)

Set the index of the seleced radio button.

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.