Table Of Contents

Previous topic

pygauge

Next topic

pyprogress

This Page

phoenix_title PyGauge

This class provides a visual alternative for Gauge. It currently only support determinate mode (see PyGauge.SetValue() and PyGauge.SetRange()).


class_hierarchy Inheritance Diagram

Inheritance diagram for class PyGauge

Inheritance diagram of PyGauge


appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


super_classes Known Superclasses

PyWindow


method_summary Methods Summary

__init__ Default class constructor.
DoGetBestSize Gets the size which best suits PyGauge: for a control, it would be
GetBarColour Returns the PyGauge main bar colour.
GetBarGradient Returns a tuple containing the gradient start and end colours.
GetBorderColour Returns the PyGauge border colour.
GetBorderPadding Gets the border padding.
GetRange Returns the maximum value of the gauge.
GetValue Returns the current position of the gauge.
OnEraseBackground Handles the EVT_ERASE_BACKGROUND event for PyGauge.
OnPaint Handles the EVT_PAINT event for PyGauge.
OnTimer Handles the EVT_TIMER event for PyGauge.
SetBarColour Sets the PyGauge main bar colour.
SetBarGradient Sets the bar gradient.
SetBorderColour Sets the PyGauge border colour.
SetBorderPadding Sets the border padding.
SetRange Sets the range of the gauge. The gauge length is its
SetValue Sets the current position of the gauge.
SortForDisplay Internal method which sorts things so we draw the longest bar first.
Update Update the gauge by adding value to it over time milliseconds. The time parameter

api Class API



class PyGauge(PyWindow)

This class provides a visual alternative for Gauge. It currently only support determinate mode (see PyGauge.SetValue() and PyGauge.SetRange()).


Methods



__init__(self, parent, id=ID_ANY, range=100, pos=DefaultPosition, size=(-1, 30), style=0)

Default class constructor.

Parameters:
  • 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 PyWindow 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 PyWindow.



GetBarColour(self)

Returns the PyGauge main bar colour.



GetBarGradient(self)

Returns a tuple containing the gradient start and end colours.



GetBorderColour(self)

Returns the PyGauge border colour.



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 EVT_ERASE_BACKGROUND event for PyGauge.

Parameters:event – a EraseEvent event to be processed.

Note

This method is intentionally empty to reduce flicker.



OnPaint(self, event)

Handles the EVT_PAINT event for PyGauge.

Parameters:event – a PaintEvent event to be processed.


OnTimer(self, event)

Handles the EVT_TIMER event for PyGauge.

Parameters:event – a TimerEvent event to be processed.


SetBarColour(self, colour)

Sets the PyGauge main bar colour.

Parameters:colour – an instance of Colour.


SetBarGradient(self, gradient)

Sets the bar gradient.

Parameters: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.

Parameters:colour – an instance of Colour.


SetBorderPadding(self, padding)

Sets the border padding.

Parameters:padding – pixels between the border and the progress bar.


SetRange(self, range)

Sets the range of the gauge. The gauge length is its value as a proportion of the range.

Parameters:range – The maximum value of the gauge.


SetValue(self, value)

Sets the current position of the gauge.

Parameters: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.

Parameters:
  • value – The value to be added to the gauge;
  • time – The length of time in milliseconds that it will take to move the gauge.