AGW Logo

agw_title KnobCtrl

This class can be used to simulate a knob volume control often found in PC music players.

hierarchy Inheritance Diagram

Inheritance diagram for: KnobCtrl

Inheritance diagram of KnobCtrl


supclasses Known Superclasses


appearance Control Appearance


KnobCtrl

KnobCtrl


method_summary Methods Summary

__init__Default class constructor.
CircleCoordsConverts the input values into logical x and y coordinates.
DrawDraws everything on the empty bitmap.
DrawBoundingCircleDraws the KnobCtrl bounding circle.
DrawDiagonalGradientDraw a shading of diagonal gradient to KnobCtrl.
DrawInsetCircleDraws the small knob.
DrawTagsDraws the tags.
GetAngleFromCoordReturns the angular position based on the input logical coordinates.
GetAngularRangeReturns the angular range for KnobCtrl as a tuple. The start and end
GetBoundingColourReturns the bounding circle colour.
GetFirstGradientColourReturns the first gradient colour for shading.
GetKnobRadiusReturns the knob radius, in pixels.
GetMaxValueReturns the maximum value for KnobCtrl.
GetMinValueReturns the minimum value for KnobCtrl.
GetSecondGradientColourReturns the second gradient colour for shading.
GetTagsReturns the KnobCtrl tags.
GetTagsColourReturns the tags colour.
GetTrackPositionUsed internally.
GetValueReturns the value of KnobCtrl.
OffsetColourChanges the input colour by the offset value.
OnMouseEventsHandles the wx.EVT_MOUSE_EVENTS event for KnobCtrl.
SetAngularRangeSets the angular range for KnobCtrl.
SetBoundingColourSets the bounding circle colour.
SetFirstGradientColourSets the first gradient colour for shading.
SetKnobRadiusSets the knob radius.
SetSecondGradientColourSets the second gradient colour for shading.
SetTagsSets the tags for KnobCtrl.
SetTagsColourSets the tags colour.
SetTrackPositionUsed internally.
SetValueSets programmatically the value of KnobCtrl.

API Class API

class KnobCtrl(BufferedWindow)[source]

This class can be used to simulate a knob volume control often found in PC music players.



__init__(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, agwStyle=KC_BUFFERED_DC)[source]

Default class constructor.

Parameters:
  • parent – parent window. Must not be None;
  • id – window identifier. A value of -1 indicates a default value;
  • pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
  • size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
  • style – the window style;
  • agwStyle – if set to KC_BUFFERED_DC, double-buffering will be used.


CircleCoords(radius, angle, centerX, centerY)[source]

Converts the input values into logical x and y coordinates.

Parameters:
  • radius – the KnobCtrl radius;
  • angle – the angular position of the mouse;
  • centerX – the x position of the KnobCtrl center;
  • centerX – the y position of the KnobCtrl center.


Draw(dc)[source]

Draws everything on the empty bitmap. Here all the chosen styles are applied.

Parameters:dc – an instance of wx.DC.


DrawBoundingCircle(dc, size)[source]

Draws the KnobCtrl bounding circle.

Parameters:
  • dc – an instance of wx.DC;

  • size – the control size.


DrawDiagonalGradient(dc, size)[source]

Draw a shading of diagonal gradient to KnobCtrl.

Parameters:
  • dc – an instance of wx.DC;

  • size – the control size.


DrawInsetCircle(dc, pencolour)[source]

Draws the small knob.

Parameters:
  • dc – an instance of wx.DC;

  • pencolour – the colour to use for drawing the inset circle.


DrawTags(dc, size)[source]

Draws the tags.

Parameters:
  • dc – an instance of wx.DC;

  • size – the control size.


GetAngleFromCoord(cx, cy)[source]

Returns the angular position based on the input logical coordinates. Used internally.

Parameters:
  • cx – the x logical position;
  • cy – the y logical position.


GetAngularRange()[source]

Returns the angular range for KnobCtrl as a tuple. The start and end angles in the returned tuple are given in degrees, clockwise.



GetBoundingColour()[source]

Returns the bounding circle colour.



GetFirstGradientColour()[source]

Returns the first gradient colour for shading.



GetKnobRadius()[source]

Returns the knob radius, in pixels.



GetMaxValue()[source]

Returns the maximum value for KnobCtrl.



GetMinValue()[source]

Returns the minimum value for KnobCtrl.



GetSecondGradientColour()[source]

Returns the second gradient colour for shading.



GetTags()[source]

Returns the KnobCtrl tags.



GetTagsColour()[source]

Returns the tags colour.



GetTrackPosition()[source]

Used internally.



GetValue()[source]

Returns the value of KnobCtrl.



OffsetColour(colour, offset)[source]

Changes the input colour by the offset value. Used internally.

Parameters:
  • colour – a valid wx.Colour object;
  • offset – an integer value for offsetting the input colour.


OnMouseEvents(event)[source]

Handles the wx.EVT_MOUSE_EVENTS event for KnobCtrl.

Parameters:event – a wx.MouseEvent event to be processed.


SetAngularRange(start, end)[source]

Sets the angular range for KnobCtrl.

Parameters:
  • start – the starting angle, in degrees, clockwise;
  • start – the ending angle, in degrees, clockwise.


SetBoundingColour(colour)[source]

Sets the bounding circle colour.

Parameters:colour – a valid wx.Colour object.



SetFirstGradientColour(colour)[source]

Sets the first gradient colour for shading.

Parameters:colour – a valid wx.Colour object.



SetKnobRadius(radius)[source]

Sets the knob radius.

Parameters:radius – the knob radius, in pixels.


SetSecondGradientColour(colour)[source]

Sets the second gradient colour for shading.

Parameters:colour – a valid wx.Colour object.



SetTags(tags)[source]

Sets the tags for KnobCtrl.

Parameters:tags – a list of integers ranging from minvalue to maxvalue.


SetTagsColour(colour)[source]

Sets the tags colour.

Parameters:colour – a valid wx.Colour object.



SetTrackPosition()[source]

Used internally.



SetValue(val)[source]

Sets programmatically the value of KnobCtrl.

Parameters:val – an integer specifying the new KnobCtrl value.

Note

This method does not send a KnobCtrlEvent.

Tree

Table Of Contents

Previous topic

BufferedWindow

Next topic

KnobCtrlEvent