phoenix_title wx.lib.agw.knobctrl.KnobCtrl

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


class_hierarchy Class Hierarchy

Inheritance diagram for class KnobCtrl:

appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


super_classes Known Superclasses

wx.lib.agw.knobctrl.BufferedWindow


method_summary Methods Summary

__init__

Default class constructor.

CircleCoords

Converts the input values into logical x and y coordinates.

Draw

Draws everything on the empty bitmap.

DrawBoundingCircle

Draws the KnobCtrl bounding circle.

DrawDiagonalGradient

Draw a shading of diagonal gradient to KnobCtrl.

DrawInsetCircle

Draws the small knob.

DrawTags

Draws the tags.

GetAngleFromCoord

Returns the angular position based on the input logical coordinates.

GetAngularRange

Returns the angular range for KnobCtrl as a tuple. The start and end

GetBoundingColour

Returns the bounding circle colour.

GetFirstGradientColour

Returns the first gradient colour for shading.

GetKnobRadius

Returns the knob radius, in pixels.

GetMaxValue

Returns the maximum value for KnobCtrl.

GetMinValue

Returns the minimum value for KnobCtrl.

GetSecondGradientColour

Returns the second gradient colour for shading.

GetTags

Returns the KnobCtrl tags.

GetTagsColour

Returns the tags colour.

GetTrackPosition

Used internally.

GetValue

Returns the value of KnobCtrl.

OffsetColour

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

OnMouseEvents

Handles the wx.EVT_MOUSE_EVENTS event for KnobCtrl.

SetAngularRange

Sets the angular range for KnobCtrl.

SetBoundingColour

Sets the bounding circle colour.

SetFirstGradientColour

Sets the first gradient colour for shading.

SetKnobRadius

Sets the knob radius.

SetSecondGradientColour

Sets the second gradient colour for shading.

SetTags

Sets the tags for KnobCtrl.

SetTagsColour

Sets the tags colour.

SetTrackPosition

Used internally.

SetValue

Sets programmatically the value of KnobCtrl.


api Class API

class KnobCtrl(BufferedWindow)

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


Methods

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

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(self, radius, angle, centerX, centerY)

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(self, dc)

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

Parameters:

dc – an instance of wx.DC.



DrawBoundingCircle(self, dc, size)

Draws the KnobCtrl bounding circle.

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

  • size – the control size.



DrawDiagonalGradient(self, dc, size)

Draw a shading of diagonal gradient to KnobCtrl.

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

  • size – the control size.



DrawInsetCircle(self, dc, pencolour)

Draws the small knob.

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

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



DrawTags(self, dc, size)

Draws the tags.

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

  • size – the control size.



GetAngleFromCoord(self, cx, cy)

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

Parameters:
  • cx – the x logical position;

  • cy – the y logical position.



GetAngularRange(self)

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



GetBoundingColour(self)

Returns the bounding circle colour.



GetFirstGradientColour(self)

Returns the first gradient colour for shading.



GetKnobRadius(self)

Returns the knob radius, in pixels.



GetMaxValue(self)

Returns the maximum value for KnobCtrl.



GetMinValue(self)

Returns the minimum value for KnobCtrl.



GetSecondGradientColour(self)

Returns the second gradient colour for shading.



GetTags(self)

Returns the KnobCtrl tags.



GetTagsColour(self)

Returns the tags colour.



GetTrackPosition(self)

Used internally.



GetValue(self)

Returns the value of KnobCtrl.



OffsetColour(self, colour, offset)

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(self, event)

Handles the wx.EVT_MOUSE_EVENTS event for KnobCtrl.

Parameters:

event – a MouseEvent event to be processed.



SetAngularRange(self, start, end)

Sets the angular range for KnobCtrl.

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

  • start – the ending angle, in degrees, clockwise.



SetBoundingColour(self, colour)

Sets the bounding circle colour.

Parameters:

colour – a valid wx.Colour object.



SetFirstGradientColour(self, colour)

Sets the first gradient colour for shading.

Parameters:

colour – a valid wx.Colour object.



SetKnobRadius(self, radius)

Sets the knob radius.

Parameters:

radius – the knob radius, in pixels.



SetSecondGradientColour(self, colour)

Sets the second gradient colour for shading.

Parameters:

colour – a valid wx.Colour object.



SetTags(self, tags)

Sets the tags for KnobCtrl.

Parameters:

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



SetTagsColour(self, colour)

Sets the tags colour.

Parameters:

colour – a valid wx.Colour object.



SetTrackPosition(self)

Used internally.



SetValue(self, val)

Sets programmatically the value of KnobCtrl.

Parameters:

val – an integer specifying the new KnobCtrl value.

Note

This method does not send a KnobCtrlEvent.