Rotary objects are created using the following function. A rotary is specified by two diagonal corners, its min and max values, the function to call when the user interacts with it, its various colors (background, foreground, and outline), its outline thickness, and how much it turns (a reasonable value is 300 degrees, with the maximum being 360 degrees, a full circle).
Function | Description |
Rotary(x1, y1, x2, y2, minValue, maxValue, startValue, updateFunction, foreground, background, outline, thickness, arcWidth) | Creates a Rotary knob.
|
You can create a rotary as follows:
# function to specify what happens when knob is turned def printValue(value): print value # replace this with whatever needs to happen knob = Rotary(5, 5, 100, 100, -100, 100, 0, printValue, Color.WHITE, Color.BLACK, Color.RED, 1, 300) display1.add(knob)
Once a rotary has been created, the following functions are available:
Function | Description |
knob.getValue() | Returns the current value of the rotary. |
knob.setValue(value) | Sets the current value of the rotary to value. |