phoenix_title wx.Gauge

A gauge is a horizontal or vertical bar which shows a quantity (often time).

wx.Gauge supports two working modes: determinate and indeterminate progress.

The first is the usual working mode (see SetValue and SetRange) while the second can be used when the program is doing some processing but you don’t know how much progress is being done. In this case, you can periodically call the Pulse function to make the progress bar switch to indeterminate mode (graphically it’s usually a set of blocks which move or bounce in the bar control).

wx.Gauge supports dynamic switch between these two work modes.

There are no user commands for the gauge.

^^

styles Window Styles

This class supports the following styles:

  • wx.GA_HORIZONTAL: Creates a horizontal gauge.

  • wx.GA_VERTICAL: Creates a vertical gauge.

  • wx.GA_SMOOTH: Creates smooth progress bar with one pixel wide update step (not supported by all platforms).

  • wx.GA_TEXT: Display the current value in percents in the gauge itself. This style is only supported in Qt and ignored under the other platforms. This flag is only available in wxWidgets 3.1.0 and later.

  • wx.GA_PROGRESS: Reflect the value of gauge in the application taskbar button under Windows 7 and later and the dock icon under macOS, ignored under the other platforms. This flag is only available in wxWidgets 3.1.0 and later. ^^


class_hierarchy Class Hierarchy

Inheritance diagram for class Gauge:

appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


method_summary Methods Summary

__init__

Default constructor.

Create

Creates the gauge for two-step construction.

GetClassDefaultAttributes

GetRange

Returns the maximum position of the gauge.

GetValue

Returns the current position of the gauge.

IsVertical

Returns True if the gauge is vertical (has GA_VERTICAL style) and False otherwise.

Pulse

Switch the gauge to indeterminate mode (if required) and makes the gauge move a bit to indicate the user that some progress has been made.

SetRange

Sets the range (maximum value) of the gauge.

SetValue

Sets the position of the gauge.


property_summary Properties Summary

Range

See GetRange and SetRange

Value

See GetValue and SetValue


api Class API

class wx.Gauge(Control)

Possible constructors:

Gauge()

Gauge(parent, id=ID_ANY, range=100, pos=DefaultPosition,
      size=DefaultSize, style=GA_HORIZONTAL, validator=DefaultValidator,
      name=GaugeNameStr)

A gauge is a horizontal or vertical bar which shows a quantity (often time).


Methods

__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.



__init__ (self, parent, id=ID_ANY, range=100, pos=DefaultPosition, size=DefaultSize, style=GA_HORIZONTAL, validator=DefaultValidator, name=GaugeNameStr)

Constructor, creating and showing a gauge.

Parameters
  • parent (wx.Window) – Window parent.

  • id (wx.WindowID) – Window identifier.

  • range (int) – Integer range (maximum value) of the gauge. See SetRange for more details about the meaning of this value when using the gauge in indeterminate mode.

  • pos (wx.Point) – Window position.

  • size (wx.Size) – Window size.

  • style (long) – Gauge style.

  • validator (wx.Validator) – Window validator.

  • name (string) – Window name.

See also

Create





Create(self, parent, id=ID_ANY, range=100, pos=DefaultPosition, size=DefaultSize, style=GA_HORIZONTAL, validator=DefaultValidator, name=GaugeNameStr)

Creates the gauge for two-step construction.

See wx.Gauge for further details.

Parameters
Return type

bool



static GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)
Parameters

variant (WindowVariant) –

Return type

wx.VisualAttributes



GetRange(self)

Returns the maximum position of the gauge.

Return type

int

See also

SetRange



GetValue(self)

Returns the current position of the gauge.

Return type

int

See also

SetValue



IsVertical(self)

Returns True if the gauge is vertical (has GA_VERTICAL style) and False otherwise.

Return type

bool



Pulse(self)

Switch the gauge to indeterminate mode (if required) and makes the gauge move a bit to indicate the user that some progress has been made.

Note

After calling this function the value returned by GetValue is undefined and thus you need to explicitly call SetValue if you want to restore the determinate mode.



SetRange(self, range)

Sets the range (maximum value) of the gauge.

This function makes the gauge switch to determinate mode, if it’s not already.

When the gauge is in indeterminate mode, under wxMSW the gauge repeatedly goes from zero to range and back; under other ports when in indeterminate mode, the range setting is ignored.

Parameters

range (int) –

See also

GetRange



SetValue(self, pos)

Sets the position of the gauge.

The pos must be between 0 and the gauge range as returned by GetRange , inclusive.

This function makes the gauge switch to determinate mode, if it was in indeterminate mode before.

Parameters

pos (int) – Position for the gauge level.

See also

GetValue


Properties

Range

See GetRange and SetRange



Value

See GetValue and SetValue