This class can be used to simulate a knob volume control often found in PC music players.
wx.lib.agw.knobctrl.BufferedWindow
Default class constructor. |
|
Converts the input values into logical x and y coordinates. |
|
Draws everything on the empty bitmap. |
|
Draws the |
|
Draw a shading of diagonal gradient to |
|
Draws the small knob. |
|
Draws the tags. |
|
Returns the angular position based on the input logical coordinates. |
|
Returns the angular range for |
|
Returns the bounding circle colour. |
|
Returns the first gradient colour for shading. |
|
Returns the knob radius, in pixels. |
|
Returns the maximum value for |
|
Returns the minimum value for |
|
Returns the second gradient colour for shading. |
|
Returns the |
|
Returns the tags colour. |
|
Used internally. |
|
Returns the value of |
|
Changes the input colour by the offset value. Used internally. |
|
Handles the |
|
Sets the angular range for |
|
Sets the bounding circle colour. |
|
Sets the first gradient colour for shading. |
|
Sets the knob radius. |
|
Sets the second gradient colour for shading. |
|
Sets the tags for |
|
Sets the tags colour. |
|
Used internally. |
|
Sets programmatically the value of |
KnobCtrl
(BufferedWindow)¶This class can be used to simulate a knob volume control often found in PC music players.
__init__
(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, agwStyle=KC_BUFFERED_DC)¶Default class constructor.
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.
Draw
(self, dc)¶Draws everything on the empty bitmap. Here all the chosen styles are applied.
dc – an instance of wx.DC
.
DrawBoundingCircle
(self, dc, size)¶Draws the KnobCtrl
bounding circle.
dc – an instance of wx.DC
;
size – the control size.
DrawDiagonalGradient
(self, dc, size)¶Draw a shading of diagonal gradient to KnobCtrl
.
dc – an instance of wx.DC
;
size – the control size.
DrawInsetCircle
(self, dc, pencolour)¶Draws the small knob.
dc – an instance of wx.DC
;
pencolour – the colour to use for drawing the inset circle.
DrawTags
(self, dc, size)¶Draws the tags.
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.
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.
GetSecondGradientColour
(self)¶Returns the second gradient colour for shading.
GetTagsColour
(self)¶Returns the tags colour.
GetTrackPosition
(self)¶Used internally.
OffsetColour
(self, colour, offset)¶Changes the input colour by the offset value. Used internally.
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
.
event – a MouseEvent
event to be processed.
SetAngularRange
(self, start, end)¶Sets the angular range for KnobCtrl
.
start – the starting angle, in degrees, clockwise;
start – the ending angle, in degrees, clockwise.
SetBoundingColour
(self, colour)¶Sets the bounding circle colour.
colour – a valid wx.Colour
object.
SetFirstGradientColour
(self, colour)¶Sets the first gradient colour for shading.
colour – a valid wx.Colour
object.
SetKnobRadius
(self, radius)¶Sets the knob radius.
radius – the knob radius, in pixels.
SetSecondGradientColour
(self, colour)¶Sets the second gradient colour for shading.
colour – a valid wx.Colour
object.
SetTags
(self, tags)¶Sets the tags for KnobCtrl
.
tags – a list of integers ranging from minvalue to maxvalue.
SetTrackPosition
(self)¶Used internally.
SetValue
(self, val)¶Sets programmatically the value of KnobCtrl
.
val – an integer specifying the new KnobCtrl
value.
Note
This method does not send a KnobCtrlEvent
.