A rotary can be drawn on a display and used to control the parameters being given to a particular function via the level of the rotary as indicated by color fill, which is controlled by clicking and dragging the mouse. As an example, a rotary could be used to set the bpm or volume.

A rotary is is oriented vertically (with 0 and max at bottom). It is specified by two diagonal corners, 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 the arc length of the rotary (a reasonable value is 300 degrees, with the maximum being 360 degrees, a full circle.).

To create a rotary, you must have a display to draw it on.

d = Display()

When creating a new rotary object, you need to store it in a variable (or other memory location) to be able to use it later.

Function Description
Rotary(x1, y1, x2, y2, minValue, maxValue, startValue, updateFunction, foreground, background, outline, thickness, arcWidth) Creates a rotary. x1 and y1 specify coordinates of one corner, x2 and y2 specify coordinates of the diagonal corner. The rotary is created within the box specified. minValue is the value of the rotary when it is at its lowest (default is 0), while maxValue is the value of the rotary at its highest(default is 999). startValue indicates the starting value of the rotary (default is none). updateFunction (default is None) is the function that this rotary calls when moved. foreground is the color of the level displayed in the rotary(default is red), background is the color behind it (default is black), outline specifies the color of the rotary’s outline (default is blue), and thickness specifies the thickness in pixels of this outline (default is 3). arcWidth specifies the size of the rotary’s angle in degrees (default is 300).

You can create a rotary as follows:

r = Rotary(5, 5, 100, 100, -100, 100, 0, None, Color.WHITE, Color.BLACK, Color.RED, 1, 180)

and add it to the display:


Once a rotary has been created, the following functions are available:

Function Description
r.getValue() Returns the current value of the rotary.
r.setValue(externalValue) Sets the current value of the rotary to ‘externalValue’.