This class provides a visual alternative for Gauge
. It currently
only support determinate mode (see PyGauge.SetValue()
and
PyGauge.SetRange()
).
Default class constructor. |
|
Gets the size which best suits |
|
Returns the |
|
Returns a tuple containing the gradient start and end colours. |
|
Returns the |
|
Gets the border padding. |
|
Returns the maximum value of the gauge. |
|
Returns the current position of the gauge. |
|
Handles the |
|
Handles the |
|
Handles the |
|
Sets the |
|
Sets the bar gradient. |
|
Sets the |
|
Sets the border padding. |
|
Sets whether percentage or current value should be drawn on the gauge for precise indication. |
|
Sets the range of the gauge. The gauge length is its |
|
Sets the current position of the gauge. |
|
Internal method which sorts things so we draw the longest bar first. |
|
Update the gauge by adding value to it over |
PyGauge
(wx.Window)¶This class provides a visual alternative for Gauge
. It currently
only support determinate mode (see PyGauge.SetValue()
and
PyGauge.SetRange()
).
__init__
(self, parent, id=wx.ID_ANY, range=100, pos=wx.DefaultPosition, size=(-1, 30), style=0)¶Default class constructor.
parent – parent window. 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.Window
window style.
DoGetBestSize
(self)¶Gets the size which best suits PyGauge
: 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.Window
.
GetBarGradient
(self)¶Returns a tuple containing the gradient start and end colours.
GetBorderPadding
(self)¶Gets the border padding.
GetRange
(self)¶Returns the maximum value of the gauge.
GetValue
(self)¶Returns the current position of the gauge.
OnEraseBackground
(self, event)¶Handles the wx.EVT_ERASE_BACKGROUND
event for PyGauge
.
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 PyGauge
.
event – a PaintEvent
event to be processed.
OnTimer
(self, event)¶Handles the wx.EVT_TIMER
event for PyGauge
.
event – a TimerEvent
event to be processed.
SetBarColour
(self, colour)¶Sets the PyGauge
main bar colour.
colour – an instance of wx.Colour
.
SetBarGradient
(self, gradient)¶Sets the bar gradient.
gradient – a tuple containing the gradient start and end colours.
Note
This overrides the bar colour previously set with PyGauge.SetBarColour
.
SetBorderColour
(self, colour)¶Sets the PyGauge
border colour.
colour – an instance of wx.Colour
.
SetBorderPadding
(self, padding)¶Sets the border padding.
padding – pixels between the border and the progress bar.
SetDrawValue
(self, draw=True, drawPercent=True, font=None, colour=wx.BLACK, formatString=None)¶Sets whether percentage or current value should be drawn on the gauge for precise indication.
draw (bool) – a boolean value, which if True
tells to start drawing value or percentage.
If set to False
nothing will be drawn and other parameters will be ignored;
drawPercent (bool) – a boolean value which indicates that a percent should be drawn instead
of value passed in SetValue
;
font (wx.Font) – a font with which indication should be drawn, if None
, then wx.NORMAL_FONT
will be used. Usually text would be displayed centered in the control, but if the text font is too large
to be displayed (either in width or height) the corresponding coordinate will be set to zero;
colour (wx.Colour) – the colour with which indication should be drawn, if None
then wx.BLACK
will be used;
formatString (string) – a string specifying format of the indication (could have one and only one unnamed
number placeholder and a value and range number placeholder). If set to None
, will use {value:.0f}
format string for values and ``{value:.0f}%` format string for percentages. As described in
http://docs.python.org/library/string.html#format-specification-mini-language.
Note
formatString will override addition of percent sign (after value) even if drawPercent is True
.
New in version 0.9.7.
SetRange
(self, range)¶Sets the range of the gauge. The gauge length is its value as a proportion of the range.
range – The maximum value of the gauge.
SetValue
(self, value)¶Sets the current position of the gauge.
value – an integer specifying the current position of the gauge.
SortForDisplay
(self)¶Internal method which sorts things so we draw the longest bar first.
Update
(self, value, time=0)¶Update the gauge by adding value to it over time
milliseconds. The time
parameter
must be a multiple of 50 milliseconds.
value – The value to be added to the gauge;
time – The length of time in milliseconds that it will take to move the gauge.