LevelIndicator

class vanilla.LevelIndicator(posSize, style='discrete', value=5, minValue=0, maxValue=10, warningValue=None, criticalValue=None, tickMarkPosition=None, minorTickMarkCount=None, majorTickMarkCount=None, callback=None)

A control which shows a value on a linear scale.:

from vanilla import *

class LevelIndicatorDemo(object):

     def __init__(self):
         self.w = Window((200, 68))
         self.w.discreteIndicator = LevelIndicator(
                    (10, 10, -10, 18), callback=self.levelIndicatorCallback)
         self.w.continuousIndicator = LevelIndicator(
                    (10, 40, -10, 18), style="continuous",
                    callback=self.levelIndicatorCallback)
         self.w.open()

     def levelIndicatorCallback(self, sender):
         print "level indicator edit!", sender.get()

LevelIndicatorDemo()

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

Standard Dimensions()
discrete without ticks
H | 18
discrete with minor ticks
H | 22
discrete with major ticks
H | 25
continuous without ticks
H | 16
continuous with minor ticks
H | 20
continuous with major ticks
H | 23

style The style of the level indicator. The options are:

“continuous” A continuous bar.
“discrete” A segmented bar.

value The initial value of the level indicator.

minValue The minimum value allowed by the level indicator.

maxValue The maximum value allowed by the level indicator.

warningValue The value at which the filled portions of the level indicator should display the warning color.

criticalValue The value at which the filled portions of the level indicator should display the critical color.

tickMarkPosition The position of the tick marks in relation to the level indicator. The options are:

“above”
“below”

minorTickMarkCount The number of minor tick marcks to be displayed on the level indicator. If None is given, no minor tick marks will be displayed.

majorTickMarkCount The number of major tick marcks to be displayed on the level indicator. If None is given, no major tick marks will be displayed.

callback The method to be called when the level indicator has been edited. If no callback is given, the level indicator will not be editable.

enable(onOff)

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

get()

Get the value of the level indicator.

getCriticalValue(value)

Get the critical value of the level indicator.

getMaxValue()

Get the maximum of the level indicator.

getMinValue()

Get the minimum value of the level indicator.

getNSLevelIndicator()

Return the NSLevelIndicator 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.

getWarningValue(value)

Get the warning value of the level indicator.

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 value of the level indicator.

setCriticalValue(value)

Set the critical value of the level indicator.

setMaxValue(value)

Set the maximum of the level indicator.

setMinValue(value)

Set the minimum value of the level indicator.

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.

setWarningValue(value)

Set the warning value of the level indicator.

show(onOff)

Show or hide the object.

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