.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.agw.knobctrl
.. highlight:: python
.. _wx.lib.agw.knobctrl.KnobCtrl:
==========================================================================================================================================
|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
=================================
.. raw:: html

Inheritance diagram for class
KnobCtrl:
|
|appearance| Control Appearance
===============================
|
.. container:: control-appearance-figures
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.knobctrl.knobctrl.png
:alt: wxMSW
:figclass: appearance-figure
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
:alt: wxMAC
:figclass: appearance-figure
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/../no_appearance.png
:alt: wxGTK
:figclass: appearance-figure
**wxGTK**
|
|super_classes| Known Superclasses
==================================
:class:`wx.lib.agw.knobctrl.BufferedWindow`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.__init__` Default class constructor.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.CircleCoords` Converts the input values into logical `x` and `y` coordinates.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.Draw` Draws everything on the empty bitmap.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.DrawBoundingCircle` Draws the :class:`KnobCtrl` bounding circle.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.DrawDiagonalGradient` Draw a shading of diagonal gradient to :class:`KnobCtrl`.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.DrawInsetCircle` Draws the small knob.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.DrawTags` Draws the tags.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetAngleFromCoord` Returns the angular position based on the input logical coordinates.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetAngularRange` Returns the angular range for :class:`KnobCtrl` as a tuple. The `start` and `end`
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetBoundingColour` Returns the bounding circle colour.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetFirstGradientColour` Returns the first gradient colour for shading.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetKnobRadius` Returns the knob radius, in pixels.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetMaxValue` Returns the maximum value for :class:`KnobCtrl`.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetMinValue` Returns the minimum value for :class:`KnobCtrl`.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetSecondGradientColour` Returns the second gradient colour for shading.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetTags` Returns the :class:`KnobCtrl` tags.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetTagsColour` Returns the tags colour.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetTrackPosition` Used internally.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.GetValue` Returns the value of :class:`KnobCtrl`.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.OffsetColour` Changes the input colour by the `offset` value. Used internally.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.OnMouseEvents` Handles the ``wx.EVT_MOUSE_EVENTS`` event for :class:`KnobCtrl`.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.SetAngularRange` Sets the angular range for :class:`KnobCtrl`.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.SetBoundingColour` Sets the bounding circle colour.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.SetFirstGradientColour` Sets the first gradient colour for shading.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.SetKnobRadius` Sets the knob radius.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.SetSecondGradientColour` Sets the second gradient colour for shading.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.SetTags` Sets the tags for :class:`KnobCtrl`.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.SetTagsColour` Sets the tags colour.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.SetTrackPosition` Used internally.
:meth:`~wx.lib.agw.knobctrl.KnobCtrl.SetValue` Sets programmatically the value of :class:`KnobCtrl`.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: KnobCtrl(BufferedWindow)
This class can be used to simulate a knob volume control often found in
PC music players.
.. method:: __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, agwStyle=KC_BUFFERED_DC)
Default class constructor.
:param `parent`: parent window. Must not be ``None``;
:param `id`: window identifier. A value of -1 indicates a default value;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform;
:param `style`: the window style;
:param `agwStyle`: if set to ``KC_BUFFERED_DC``, double-buffering will
be used.
.. method:: CircleCoords(self, radius, angle, centerX, centerY)
Converts the input values into logical `x` and `y` coordinates.
:param `radius`: the :class:`KnobCtrl` radius;
:param `angle`: the angular position of the mouse;
:param `centerX`: the `x` position of the :class:`KnobCtrl` center;
:param `centerX`: the `y` position of the :class:`KnobCtrl` center.
.. method:: Draw(self, dc)
Draws everything on the empty bitmap.
Here all the chosen styles are applied.
:param `dc`: an instance of :class:`wx.DC`.
.. method:: DrawBoundingCircle(self, dc, size)
Draws the :class:`KnobCtrl` bounding circle.
:param `dc`: an instance of :class:`wx.DC`;
:param `size`: the control size.
.. method:: DrawDiagonalGradient(self, dc, size)
Draw a shading of diagonal gradient to :class:`KnobCtrl`.
:param `dc`: an instance of :class:`wx.DC`;
:param `size`: the control size.
.. method:: DrawInsetCircle(self, dc, pencolour)
Draws the small knob.
:param `dc`: an instance of :class:`wx.DC`;
:param `pencolour`: the colour to use for drawing the inset circle.
.. method:: DrawTags(self, dc, size)
Draws the tags.
:param `dc`: an instance of :class:`wx.DC`;
:param `size`: the control size.
.. method:: GetAngleFromCoord(self, cx, cy)
Returns the angular position based on the input logical coordinates.
Used internally.
:param `cx`: the `x` logical position;
:param `cy`: the `y` logical position.
.. method:: GetAngularRange(self)
Returns the angular range for :class:`KnobCtrl` as a tuple. The `start` and `end`
angles in the returned tuple are given in degrees, clockwise.
.. method:: GetBoundingColour(self)
Returns the bounding circle colour.
.. method:: GetFirstGradientColour(self)
Returns the first gradient colour for shading.
.. method:: GetKnobRadius(self)
Returns the knob radius, in pixels.
.. method:: GetMaxValue(self)
Returns the maximum value for :class:`KnobCtrl`.
.. method:: GetMinValue(self)
Returns the minimum value for :class:`KnobCtrl`.
.. method:: GetSecondGradientColour(self)
Returns the second gradient colour for shading.
.. method:: GetTags(self)
Returns the :class:`KnobCtrl` tags.
.. method:: GetTagsColour(self)
Returns the tags colour.
.. method:: GetTrackPosition(self)
Used internally.
.. method:: GetValue(self)
Returns the value of :class:`KnobCtrl`.
.. method:: OffsetColour(self, colour, offset)
Changes the input colour by the `offset` value. Used internally.
:param `colour`: a valid :class:`wx.Colour` object;
:param `offset`: an integer value for offsetting the input colour.
.. method:: OnMouseEvents(self, event)
Handles the ``wx.EVT_MOUSE_EVENTS`` event for :class:`KnobCtrl`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: SetAngularRange(self, start, end)
Sets the angular range for :class:`KnobCtrl`.
:param `start`: the starting angle, in degrees, clockwise;
:param `start`: the ending angle, in degrees, clockwise.
.. method:: SetBoundingColour(self, colour)
Sets the bounding circle colour.
:param `colour`: a valid :class:`wx.Colour` object.
.. method:: SetFirstGradientColour(self, colour)
Sets the first gradient colour for shading.
:param `colour`: a valid :class:`wx.Colour` object.
.. method:: SetKnobRadius(self, radius)
Sets the knob radius.
:param `radius`: the knob radius, in pixels.
.. method:: SetSecondGradientColour(self, colour)
Sets the second gradient colour for shading.
:param `colour`: a valid :class:`wx.Colour` object.
.. method:: SetTags(self, tags)
Sets the tags for :class:`KnobCtrl`.
:param `tags`: a list of integers ranging from `minvalue` to `maxvalue`.
.. method:: SetTagsColour(self, colour)
Sets the tags colour.
:param `colour`: a valid :class:`wx.Colour` object.
.. method:: SetTrackPosition(self)
Used internally.
.. method:: SetValue(self, val)
Sets programmatically the value of :class:`KnobCtrl`.
:param `val`: an integer specifying the new :class:`KnobCtrl` value.
.. note:: This method does not send a :class:`KnobCtrlEvent`.