.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2017 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.agw.peakmeter

.. highlight:: python



.. _wx.lib.agw.peakmeter.PeakMeterCtrl:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.peakmeter.PeakMeterCtrl**
==========================================================================================================================================

The main :class:`PeakMeterCtrl` implementation. 



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>PeakMeterCtrl</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.agw.peakmeter.PeakMeterCtrl_inheritance.png" alt="Inheritance diagram of PeakMeterCtrl" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="23,5,124,35"/> <area shape="rect" id="node2" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="75,83,185,112"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="70,160,191,189"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="148,5,229,35"/> <area shape="rect" id="node4" href="wx.Control.html" title="wx.Control" alt="" coords="87,315,175,344"/> <area shape="rect" id="node7" href="wx.lib.agw.peakmeter.PeakMeterCtrl.html" title="wx.lib.agw.peakmeter.PeakMeterCtrl" alt="" coords="5,392,256,421"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window" alt="" coords="86,237,175,267"/> </map> 
   </p>

|


|appearance| Control Appearance
===============================

|

.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.peakmeter.peakmeterctrl.png
   :alt: wxMSW
   :figclass: floatleft

   **wxMSW**


.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
   :alt: wxMAC
   :figclass: floatright

   **wxMAC**


.. figure:: _static/images/widgets/fullsize/wxgtk/../no_appearance.png
   :alt: wxGTK
   :figclass: floatcenter

   **wxGTK**


|




|super_classes| Known Superclasses
==================================

:class:`wx.Control`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.__init__`                             Default class constructor.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.DoGetBestSize`                        Gets the size which best suits the window: for a control, it would be the
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.DoTimerProcessing`                    :class:`PeakMeterCtrl` animation, does the ``wx.EVT_TIMER`` processing.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.DrawHorzBand`                         Draws horizontal bands.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.DrawVertBand`                         Draws vertical bands.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.DrawVertBandInverted`                 Draws vertical bands inverted.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.GetAGWWindowStyleFlag`                Returns the :class:`PeakMeterCtrl` window style.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.GetFalloffEffect`                     Returns the falloff effect flag.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.GetRangeValue`                        Get range value of :class:`PeakMeterCtrl`.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.InitData`                             Initializes the control.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.IsGridVisible`                        Returns if gridlines are visible.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.IsStarted`                            Check if animation is active.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.OnEraseBackground`                    Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`PeakMeterCtrl`.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.OnPaint`                              Handles the ``wx.EVT_PAINT`` event for :class:`PeakMeterCtrl`.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.OnSize`                               Handles the ``wx.EVT_SIZE`` event for :class:`PeakMeterCtrl`.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.OnTimer`                              Handles the ``wx.EVT_TIMER`` event for :class:`PeakMeterCtrl`.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.ResetControl`                         Resets the :class:`PeakMeterCtrl`.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.SetAGWWindowStyleFlag`                Sets the :class:`PeakMeterCtrl` window style flags.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.SetBackgroundColour`                  Changes the background colour of :class:`PeakMeterCtrl`.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.SetBandsColour`                       Set bands colour for :class:`PeakMeterCtrl`.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.SetData`                              Change data value. Use this function to change only
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.SetFalloffDelay`                      Set peak value speed before falling off.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.SetFalloffEffect`                     Set falloff effect flag.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.SetMeterBands`                        Set number of vertical or horizontal bands to display.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.SetRangeValue`                        Sets the ranges for low, medium and high bands.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.ShowGrid`                             Request to have gridlines visible or not.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.Start`                                Start the timer and animation effect.
:meth:`~wx.lib.agw.peakmeter.PeakMeterCtrl.Stop`                                 Stop the timer and animation effect.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: PeakMeterCtrl(wx.Control)

   The main :class:`PeakMeterCtrl` implementation. 

   .. method:: __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=PM_VERTICAL)

      Default class constructor.
      
      :param parent: the :class:`PeakMeterCtrl` parent. 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 underlying :class:`wx.Control` window style;
      :param `agwStyle`: the AGW-specific window style, which can be one of the following bits:
      
       ======================== =========== ========================================================
       Window Styles            Hex Value   Description
       ======================== =========== ========================================================
       ``PM_HORIZONTAL``        0x0         Shows horizontal bands in :class:`PeakMeterCtrl`.
       ``PM_VERTICAL``          0x1         Shows vertical bands in :class:`PeakMeterCtrl`.
       ``PM_VERTICAL_INVERTED`` 0x2         Shows inverted vertical bands in :class:`PeakMeterCtrl`.
       ======================== =========== ========================================================


   .. method:: DoGetBestSize(self)

      Gets the size which best suits the window: for a control, it would be the
      minimal size which doesn't truncate the control, for a panel - the same size
      as it would have after a call to `Fit()`.
      
      :note: Overridden from :class:`wx.Control`.


   .. method:: DoTimerProcessing(self)

      :class:`PeakMeterCtrl` animation, does the ``wx.EVT_TIMER`` processing. 


   .. method:: DrawHorzBand(self, dc, rect)

      Draws horizontal bands.
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: the horizontal bands client rectangle.
      
      .. todo:: Implement falloff effect for horizontal bands.


   .. method:: DrawVertBand(self, dc, rect)

      Draws vertical bands.
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: the vertical bands client rectangle.


   .. method:: DrawVertBandInverted(self, dc, rect)

      Draws vertical bands inverted.
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: the vertical bands client rectangle.


   .. method:: GetAGWWindowStyleFlag(self)

      Returns the :class:`PeakMeterCtrl` window style.
      
      :see: :meth:`PeakMeterCtrl.SetAGWWindowStyleFlag` for a list of possible window style flags.


   .. method:: GetFalloffEffect(self)

      Returns the falloff effect flag. 


   .. method:: GetRangeValue(self)

      Get range value of :class:`PeakMeterCtrl`. 


   .. method:: InitData(self)

      Initializes the control. 


   .. method:: IsGridVisible(self)

      Returns if gridlines are visible. 


   .. method:: IsStarted(self)

      Check if animation is active. 


   .. method:: OnEraseBackground(self, event)

      Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`PeakMeterCtrl`.
      
      :param `event`: a :class:`EraseEvent` event to be processed.
      
      :note: This method is intentionally empty to reduce flicker.


   .. method:: OnPaint(self, event)

      Handles the ``wx.EVT_PAINT`` event for :class:`PeakMeterCtrl`.
      
      :param `event`: a :class:`PaintEvent` event to be processed.


   .. method:: OnSize(self, event)

      Handles the ``wx.EVT_SIZE`` event for :class:`PeakMeterCtrl`.
      
      :param `event`: a :class:`wx.SizeEvent` event to be processed.


   .. method:: OnTimer(self, event)

      Handles the ``wx.EVT_TIMER`` event for :class:`PeakMeterCtrl`.
      
      :param `event`: a :class:`TimerEvent` event to be processed.


   .. method:: ResetControl(self)

      Resets the :class:`PeakMeterCtrl`. 


   .. method:: SetAGWWindowStyleFlag(self, agwStyle)

      Sets the :class:`PeakMeterCtrl` window style flags.
      
      :param `agwStyle`: the AGW-specific window style. This can be a combination of the
       following bits:
      
       ======================== =========== ========================================================
       Window Styles            Hex Value   Description
       ======================== =========== ========================================================
       ``PM_HORIZONTAL``        0x0         Shows horizontal bands in :class:`PeakMeterCtrl`.
       ``PM_VERTICAL``          0x1         Shows vertical bands in :class:`PeakMeterCtrl`.
       ``PM_VERTICAL_INVERTED`` 0x2         Shows inverted vertical bands in :class:`PeakMeterCtrl`.
       ======================== =========== ========================================================


   .. method:: SetBackgroundColour(self, colourBgnd)

      Changes the background colour of :class:`PeakMeterCtrl`.
      
      :param `colourBgnd`: the colour to be used as the background colour, pass
       :class:`NullColour` to reset to the default colour.
      
      :note: The background colour is usually painted by the default :class:`EraseEvent`
       event handler function under Windows and automatically under GTK.
      
      :note: Setting the background colour does not cause an immediate refresh, so
       you may wish to call :meth:`wx.Window.ClearBackground` or :meth:`wx.Window.Refresh` after
       calling this function.
      
      :note: Overridden from :class:`wx.Control`.


   .. method:: SetBandsColour(self, colourNormal, colourMedium, colourHigh)

      Set bands colour for :class:`PeakMeterCtrl`.
      
      :param `colourNormal`: the colour for normal (low) bands, a valid :class:`wx.Colour`
       object;
      :param `colourMedium`: the colour for medium bands, a valid :class:`wx.Colour`
       object;
      :param `colourHigh`: the colour for high bands, a valid :class:`wx.Colour`
       object.


   .. method:: SetData(self, arrayValue, offset, size)

      Change data value. Use this function to change only
      a set of values. All bands can be changed or only 1 band,
      depending on the application.
      
      :param `arrayValue`: a Python list containing the :class:`PeakMeterData` values;
      :param `offset`: the (optional) offset where to start applying the new data;
      :param `size`: the size of the input data.


   .. method:: SetFalloffDelay(self, speed)

      Set peak value speed before falling off.
      
      :param `speed`: the speed at which the falloff happens.


   .. method:: SetFalloffEffect(self, falloffEffect)

      Set falloff effect flag.
      
      :param `falloffEffect`: ``True`` to enable the falloff effect, ``False``
       to disable it.


   .. method:: SetMeterBands(self, numBands, ledBands)

      Set number of vertical or horizontal bands to display.
      
      :param `numBands`: number of bands to display (either vertical or horizontal);
      :param `ledBands`: the number of leds per band.
      
      :note: You can obtain a smooth effect by setting `nHorz` or `nVert` to "1", these
       cannot be 0.


   .. method:: SetRangeValue(self, minVal, medVal, maxVal)

      Sets the ranges for low, medium and high bands.
      
      :param `minVal`: the value for low bands;
      :param `medVal`: the value for medium bands;
      :param `maxVal`: the value for high bands.
      
      :note: The conditions to be satisfied are:
      
       Min: [0 - nMin[,  Med: [nMin - nMed[,  Max: [nMed - nMax]


   .. method:: ShowGrid(self, showGrid)

      Request to have gridlines visible or not.
      
      :param `showGrid`: ``True`` to show grid lines, ``False`` otherwise.


   .. method:: Start(self, delay)

      Start the timer and animation effect.
      
      :param `delay`: the animation effect delay, in milliseconds.


   .. method:: Stop(self)

      Stop the timer and animation effect. 


