The main PeakMeterCtrl
implementation.
Default class constructor. |
|
Gets the size which best suits the window: for a control, it would be the |
|
|
|
Draws horizontal bands. |
|
Draws vertical bands. |
|
Draws vertical bands inverted. |
|
Returns the |
|
Returns the falloff effect flag. |
|
Get range value of |
|
Initializes the control. |
|
Returns if gridlines are visible. |
|
Check if animation is active. |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Resets the |
|
Sets the |
|
Changes the background colour of |
|
Set bands colour for |
|
Change data value. Use this function to change only |
|
Set peak value speed before falling off. |
|
Set falloff effect flag. |
|
Set number of vertical or horizontal bands to display. |
|
Sets the ranges for low, medium and high bands. |
|
Request to have gridlines visible or not. |
|
Start the timer and animation effect. |
|
Stop the timer and animation effect. |
PeakMeterCtrl
(wx.Control)¶The main PeakMeterCtrl
implementation.
__init__
(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=PM_VERTICAL)¶Default class constructor.
parent – the PeakMeterCtrl
parent. 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 underlying wx.Control
window style;
agwStyle – the AGW-specific window style, which can be one of the following bits:
Window Styles |
Hex Value |
Description |
---|---|---|
|
0x0 |
Shows horizontal bands in |
|
0x1 |
Shows vertical bands in |
|
0x2 |
Shows inverted vertical bands in |
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 wx.Control
.
DoTimerProcessing
(self)¶PeakMeterCtrl
animation, does the wx.EVT_TIMER
processing.
DrawHorzBand
(self, dc, rect)¶Draws horizontal bands.
dc – an instance of wx.DC
;
rect – the horizontal bands client rectangle.
Todo
Implement falloff effect for horizontal bands.
DrawVertBand
(self, dc, rect)¶Draws vertical bands.
dc – an instance of wx.DC
;
rect – the vertical bands client rectangle.
DrawVertBandInverted
(self, dc, rect)¶Draws vertical bands inverted.
dc – an instance of wx.DC
;
rect – the vertical bands client rectangle.
GetAGWWindowStyleFlag
(self)¶Returns the PeakMeterCtrl
window style.
See also
PeakMeterCtrl.SetAGWWindowStyleFlag
for a list of possible window style flags.
GetFalloffEffect
(self)¶Returns the falloff effect flag.
GetRangeValue
(self)¶Get range value of PeakMeterCtrl
.
InitData
(self)¶Initializes the control.
IsGridVisible
(self)¶Returns if gridlines are visible.
IsStarted
(self)¶Check if animation is active.
OnEraseBackground
(self, event)¶Handles the wx.EVT_ERASE_BACKGROUND
event for PeakMeterCtrl
.
event – a EraseEvent
event to be processed.
Note
This method is intentionally empty to reduce flicker.
OnPaint
(self, event)¶Handles the wx.EVT_PAINT
event for PeakMeterCtrl
.
event – a PaintEvent
event to be processed.
OnSize
(self, event)¶Handles the wx.EVT_SIZE
event for PeakMeterCtrl
.
event – a wx.SizeEvent
event to be processed.
OnTimer
(self, event)¶Handles the wx.EVT_TIMER
event for PeakMeterCtrl
.
event – a TimerEvent
event to be processed.
ResetControl
(self)¶Resets the PeakMeterCtrl
.
SetAGWWindowStyleFlag
(self, agwStyle)¶Sets the PeakMeterCtrl
window style flags.
agwStyle –
the AGW-specific window style. This can be a combination of the following bits:
Window Styles |
Hex Value |
Description |
---|---|---|
|
0x0 |
Shows horizontal bands in |
|
0x1 |
Shows vertical bands in |
|
0x2 |
Shows inverted vertical bands in |
SetBackgroundColour
(self, colourBgnd)¶Changes the background colour of PeakMeterCtrl
.
colourBgnd – the colour to be used as the background colour, pass
NullColour
to reset to the default colour.
Note
The background colour is usually painted by the default 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 wx.Window.ClearBackground
or wx.Window.Refresh
after
calling this function.
Note
Overridden from wx.Control
.
SetBandsColour
(self, colourNormal, colourMedium, colourHigh)¶Set bands colour for PeakMeterCtrl
.
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.
arrayValue – a Python list containing the PeakMeterData
values;
offset – the (optional) offset where to start applying the new data;
size – the size of the input data.
SetFalloffDelay
(self, speed)¶Set peak value speed before falling off.
speed – the speed at which the falloff happens.
SetFalloffEffect
(self, falloffEffect)¶Set falloff effect flag.
falloffEffect – True
to enable the falloff effect, False
to disable it.
SetMeterBands
(self, numBands, ledBands)¶Set number of vertical or horizontal bands to display.
numBands – number of bands to display (either vertical or horizontal);
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.
SetRangeValue
(self, minVal, medVal, maxVal)¶Sets the ranges for low, medium and high bands.
minVal – the value for low bands;
medVal – the value for medium bands;
maxVal – the value for high bands.
Note
The conditions to be satisfied are:
Min: [0 - nMin[, Med: [nMin - nMed[, Max: [nMed - nMax]
ShowGrid
(self, showGrid)¶Request to have gridlines visible or not.
showGrid – True
to show grid lines, False
otherwise.
Start
(self, delay)¶Start the timer and animation effect.
delay – the animation effect delay, in milliseconds.
Stop
(self)¶Stop the timer and animation effect.