SpeedMeter
tries to reproduce the behavior of some car controls (but not only),
by creating an “angular” control (actually, circular).
This is the main class implementation.
__init__ |
Default class constructor. |
CircleCoords |
Converts the input values into logical x, y coordinates. |
Draw |
Draws everything on the empty bitmap. |
DrawExternalArc |
Specify wheter or not you wish to draw the external (thicker) arc. |
GetAngleRange |
Returns the range of existence for SpeedMeter . |
GetArcColour |
Returns the external arc colour. |
GetDirection |
Returns the direction of advancing SpeedMeter value. |
GetFillerColour |
Returns the partial filler colour. |
GetFirstGradientColour |
Returns the first gradient colour (near the ticks). |
GetHandColour |
Returns the hand (arrow indicator) colour. |
GetHandStyle |
Returns the style for the hand (arrow indicator). |
GetIntersection |
Used internally. |
GetIntervalColours |
Returns the colours for the intervals. |
GetIntervals |
Returns the intervals for SpeedMeter , a Python list of main ticks displayed. |
GetMiddleIcon |
Returns the icon to be drawn near the center of SpeedMeter . |
GetMiddleIconDimens |
Used internally. |
GetMiddleText |
Returns the text to be drawn near the center of SpeedMeter . |
GetMiddleTextColour |
Returns the colour for the text in the middle. |
GetMiddleTextFont |
Returns the font for the text in the middle. |
GetNumberOfSecondaryTicks |
Returns the number of secondary (intermediate) ticks. |
GetSecondGradientColour |
Returns the first gradient colour (near the center). |
GetShadowColour |
Returns the hand’s shadow colour. |
GetSpeedBackground |
Returns the background colour outside the SpeedMeter control. |
GetSpeedStyle |
Returns a list of strings and a list of integers containing the styles. |
GetSpeedValue |
Returns the current value for SpeedMeter . |
GetTicks |
Returns the ticks for SpeedMeter intervals (main ticks string values). |
GetTicksColour |
Returns the ticks colour. |
GetTicksFont |
Returns the ticks font. |
OnMouseMotion |
Handles the wx.EVT_MOUSE_EVENTS event for SpeedMeter . |
SetAngleRange |
Sets the range of existence for SpeedMeter . |
SetArcColour |
Sets the external arc colour (thicker line). |
SetDirection |
Sets the direction of advancing SpeedMeter value. |
SetFillerColour |
Sets the partial filler colour. |
SetFirstGradientColour |
Sets the first gradient colour (near the ticks). |
SetHandColour |
Sets the hand (arrow indicator) colour. |
SetHandStyle |
Sets the style for the hand (arrow indicator). |
SetIntervalColours |
Sets the colours for the intervals. |
SetIntervals |
Sets the intervals for SpeedMeter (main ticks numeric values). |
SetMiddleIcon |
Sets the icon to be drawn near the center of SpeedMeter . |
SetMiddleText |
Sets the text to be drawn near the center of SpeedMeter . |
SetMiddleTextColour |
Sets the colour for the text in the middle. |
SetMiddleTextFont |
Sets the font for the text in the middle. |
SetNumberOfSecondaryTicks |
Sets the number of secondary (intermediate) ticks. |
SetSecondGradientColour |
Sets the second gradient colour (near the center). |
SetShadowColour |
Sets the hand’s shadow colour. |
SetSpeedBackground |
Sets the background colour outside the SpeedMeter control. |
SetSpeedValue |
Sets the current value for SpeedMeter . |
SetTicks |
Sets the ticks for SpeedMeter intervals (main ticks string values). |
SetTicksColour |
Sets the ticks colour. |
SetTicksFont |
Sets the ticks font. |
SpeedMeter
(BufferedWindow)¶SpeedMeter
tries to reproduce the behavior of some car controls (but not only),
by creating an “angular” control (actually, circular).
This is the main class implementation.
__init__
(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, agwStyle=SM_DRAW_HAND, bufferedstyle=SM_BUFFERED_DC, mousestyle=0)¶Default class constructor.
Parameters: |
|
---|
CircleCoords
(self, radius, angle, centerX, centerY)¶Converts the input values into logical x, y coordinates.
Parameters: |
|
---|
Draw
(self, dc)¶Draws everything on the empty bitmap. Here all the chosen styles are applied.
Parameters: | dc – an instance of wx.DC . |
---|
DrawExternalArc
(self, draw=True)¶Specify wheter or not you wish to draw the external (thicker) arc.
Parameters: | draw – True to draw the external arc, False otherwise. |
---|
GetAngleRange
(self)¶Returns the range of existence for SpeedMeter
.
The returned values are in radians.
GetArcColour
(self)¶Returns the external arc colour.
GetDirection
(self)¶Returns the direction of advancing SpeedMeter
value.
GetFillerColour
(self)¶Returns the partial filler colour.
GetFirstGradientColour
(self)¶Returns the first gradient colour (near the ticks).
GetHandColour
(self)¶Returns the hand (arrow indicator) colour.
GetHandStyle
(self)¶Returns the style for the hand (arrow indicator).
GetIntersection
(self, current, intervals)¶Used internally.
GetIntervalColours
(self)¶Returns the colours for the intervals.
GetIntervals
(self)¶Returns the intervals for SpeedMeter
, a Python list of main ticks displayed.
GetMiddleIcon
(self)¶Returns the icon to be drawn near the center of SpeedMeter
.
GetMiddleIconDimens
(self)¶Used internally.
GetMiddleText
(self)¶Returns the text to be drawn near the center of SpeedMeter
.
GetMiddleTextColour
(self)¶Returns the colour for the text in the middle.
GetMiddleTextFont
(self)¶Returns the font for the text in the middle.
GetNumberOfSecondaryTicks
(self)¶Returns the number of secondary (intermediate) ticks.
GetSecondGradientColour
(self)¶Returns the first gradient colour (near the center).
GetShadowColour
(self)¶Returns the hand’s shadow colour.
GetSpeedBackground
(self)¶Returns the background colour outside the SpeedMeter
control.
GetSpeedStyle
(self)¶Returns a list of strings and a list of integers containing the styles.
GetSpeedValue
(self)¶Returns the current value for SpeedMeter
.
GetTicks
(self)¶Returns the ticks for SpeedMeter
intervals (main ticks string values).
GetTicksColour
(self)¶Returns the ticks colour.
GetTicksFont
(self)¶Returns the ticks font.
OnMouseMotion
(self, event)¶Handles the wx.EVT_MOUSE_EVENTS
event for SpeedMeter
.
Parameters: | event – a MouseEvent event to be processed. |
---|
Note
Here only left clicks/drags are involved. Should SpeedMeter
have something more?
SetAngleRange
(self, start=0, end=pi)¶Sets the range of existence for SpeedMeter
.
Parameters: |
|
---|
SetArcColour
(self, colour=None)¶Sets the external arc colour (thicker line).
Parameters: | colour – a valid wx.Colour object. If defaulted to None , the arc
colour will be black. |
---|
SetDirection
(self, direction=None)¶Sets the direction of advancing SpeedMeter
value.
Parameters: | direction – specifying “advance” will move the hand in clock-wise direction
(like normal car speed control), while using “reverse” will move it counterclock-wise
direction. If defaulted to None , then “advance” will be used. |
---|
SetFillerColour
(self, colour=None)¶Sets the partial filler colour.
A circle corona near the ticks will be filled with this colour, from
the starting value to the current value of SpeedMeter
.
Parameters: | colour – a valid wx.Colour object. |
---|
SetFirstGradientColour
(self, colour=None)¶Sets the first gradient colour (near the ticks).
Parameters: | colour – a valid wx.Colour object. |
---|
SetHandColour
(self, colour=None)¶Sets the hand (arrow indicator) colour.
Parameters: | colour – a valid wx.Colour object. If defaulted to None , the arrow
indicator will be red. |
---|
SetHandStyle
(self, style=None)¶Sets the style for the hand (arrow indicator).
Parameters: | style – by specifying “Hand”, SpeedMeter will draw a polygon
that simulates the car speed control indicator. Using “Arrow” will force
SpeedMeter to draw a simple arrow. If defaulted to None , “Hand” will
be used. |
---|
SetIntervalColours
(self, colours=None)¶Sets the colours for the intervals.
Parameters: | colours – a Python list of colours. The length of this list should be
the same as the number of circle sectors in SpeedMeter . If defaulted to None ,
all the intervals will have a white colour. |
---|
Note
Every interval (circle sector) should have a colour.
SetIntervals
(self, intervals=None)¶Sets the intervals for SpeedMeter
(main ticks numeric values).
Parameters: | intervals – a Python list of main ticks to be displayed. If defaulted
to None , the list [0, 50, 100] is used. |
---|
SetMiddleIcon
(self, icon)¶Sets the icon to be drawn near the center of SpeedMeter
.
Parameters: | icon – a valid wx.Bitmap object. |
---|
SetMiddleText
(self, text=None)¶Sets the text to be drawn near the center of SpeedMeter
.
Parameters: | text – the text to be drawn near the center of SpeedMeter . If
defaulted to None , an empty string will be used. |
---|
SetMiddleTextColour
(self, colour=None)¶Sets the colour for the text in the middle.
Parameters: | colour – a valid wx.Colour object. If defaulted to None , the text
in the middle will be painted in blue. |
---|
SetMiddleTextFont
(self, font=None)¶Sets the font for the text in the middle.
Parameters: | font – a valid wx.Font object. If defaulted to None , some
standard font will be generated. |
---|
SetNumberOfSecondaryTicks
(self, ticknum=None)¶Sets the number of secondary (intermediate) ticks.
Parameters: | ticknum – the number of intermediate ticks. If defaulted to None ,
3 ticks are used. |
---|
SetSecondGradientColour
(self, colour=None)¶Sets the second gradient colour (near the center).
Parameters: | colour – a valid wx.Colour object. |
---|
SetShadowColour
(self, colour=None)¶Sets the hand’s shadow colour.
Parameters: | colour – a valid wx.Colour object. If defaulted to None , the shadow
colour will be light grey. |
---|
SetSpeedBackground
(self, colour=None)¶Sets the background colour outside the SpeedMeter
control.
Parameters: | colour – a valid wx.Colour object. If defaulted to None , the
SpeedMeter background will be taken from the system default. |
---|
SetSpeedValue
(self, value=None)¶Sets the current value for SpeedMeter
.
Parameters: | value – a floating point number representing the current value. If defaulted
to None , the SpeedMeter value will be the middle point of the control range. |
---|
SetTicks
(self, ticks=None)¶Sets the ticks for SpeedMeter
intervals (main ticks string values).
Parameters: | ticks – a Python list of strings, representing the ticks values.
If defaulted to None , the ticks will be taken from the interval values. |
---|
SetTicksColour
(self, colour=None)¶Sets the ticks colour.
Parameters: | colour – a valid wx.Colour object. If defaulted to None , the
ticks colour will be set as blue. |
---|