# 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.

## 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).

## Class Hierarchy¶

Inheritance diagram for class Gauge:

wxMSW

wxMAC

wxGTK

## Methods Summary¶

 __init__ Default constructor. Create Creates the gauge for two-step construction. GetBezelFace Returns the width of the 3D bezel face. GetClassDefaultAttributes GetRange Returns the maximum position of the gauge. GetShadowWidth Returns the 3D shadow margin width. 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. SetBezelFace Sets the 3D bezel face width. SetRange Sets the range (maximum value) of the gauge. SetShadowWidth Sets the 3D shadow width. SetValue Sets the position of the gauge.

## 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)

__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.

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

GetBezelFace(self)

Returns the width of the 3D bezel face.

Return type

int

Note

This method is not implemented (returns 0) for most platforms.

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

GetShadowWidth(self)

Returns the 3D shadow margin width.

Return type

int

Note

This method is not implemented (returns 0) for most platforms.

GetValue(self)

Returns the current position of the gauge.

Return type

int

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.

SetBezelFace(self, width)

Sets the 3D bezel face width.

Parameters

width (int) –

Note

This method is not implemented (doesn’t do anything) for most platforms.

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) –

SetShadowWidth(self, width)

Parameters

width (int) –

Note

This method is not implemented (doesn’t do anything) for most platforms.

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.

### Properties¶

BezelFace

Range

ShadowWidth

Value