wx.lib.agw.peakmeter.PeakMeterCtrl¶
The main PeakMeterCtrl
implementation.
Class Hierarchy¶
Control Appearance¶
Known Superclasses¶
Methods Summary¶
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. |
Class API¶
- class PeakMeterCtrl(wx.Control)¶
The main
PeakMeterCtrl
implementation.
Methods¶
- __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=PM_VERTICAL)¶
Default class constructor.
- Parameters:
parent – the
PeakMeterCtrl
parent. Must not beNone
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
PM_HORIZONTAL
0x0
Shows horizontal bands in
PeakMeterCtrl
.PM_VERTICAL
0x1
Shows vertical bands in
PeakMeterCtrl
.PM_VERTICAL_INVERTED
0x2
Shows inverted vertical bands in
PeakMeterCtrl
.
- 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 thewx.EVT_TIMER
processing.
- DrawHorzBand(self, dc, rect)¶
Draws horizontal bands.
- Parameters:
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.
- Parameters:
dc – an instance of
wx.DC
;rect – the vertical bands client rectangle.
- DrawVertBandInverted(self, dc, rect)¶
Draws vertical bands inverted.
- Parameters:
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 forPeakMeterCtrl
.- Parameters:
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 forPeakMeterCtrl
.- Parameters:
event – a
PaintEvent
event to be processed.
- OnSize(self, event)¶
Handles the
wx.EVT_SIZE
event forPeakMeterCtrl
.- Parameters:
event – a
wx.SizeEvent
event to be processed.
- OnTimer(self, event)¶
Handles the
wx.EVT_TIMER
event forPeakMeterCtrl
.- Parameters:
event – a
TimerEvent
event to be processed.
- ResetControl(self)¶
Resets the
PeakMeterCtrl
.
- SetAGWWindowStyleFlag(self, agwStyle)¶
Sets the
PeakMeterCtrl
window style flags.- Parameters:
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
PeakMeterCtrl
.PM_VERTICAL
0x1
Shows vertical bands in
PeakMeterCtrl
.PM_VERTICAL_INVERTED
0x2
Shows inverted vertical bands in
PeakMeterCtrl
.
- SetBackgroundColour(self, colourBgnd)¶
Changes the background colour of
PeakMeterCtrl
.- Parameters:
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
orwx.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.
- Parameters:
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.
- Parameters:
speed – the speed at which the falloff happens.
- SetFalloffEffect(self, falloffEffect)¶
Set falloff effect flag.
- Parameters:
falloffEffect –
True
to enable the falloff effect,False
to disable it.
- SetMeterBands(self, numBands, ledBands)¶
Set number of vertical or horizontal bands to display.
- Parameters:
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.
- Parameters:
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.
- Parameters:
showGrid –
True
to show grid lines,False
otherwise.
- Start(self, delay)¶
Start the timer and animation effect.
- Parameters:
delay – the animation effect delay, in milliseconds.
- Stop(self)¶
Stop the timer and animation effect.