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.

  • x1 and y1 specify top-left corner of the box that encloses the knob, x2 and y2 specify coordinates of the bottom-right corner.
  • minValue is the lowest possible value (default is 0).
  • maxValue is the largest possible value  (default is 999).
  • startValue is the starting position of the rotary (default is half way).
  • updateFunction specifies what to do when the knob is changed.
  • foreground is the color of the level displayed by the knob (default is Color.RED).
  • background is the color behind it (default is Color.BLACK).
  • outline is the outline color (default is Color.BLUE).
  • thickness specifies the outline thickness in pixels (default is 3).
  • arcWidth specifies the maximum turning of the knob in degrees (default is 300).

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)


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.