.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.Gauge: ========================================================================================================================================== |phoenix_title| **wx.Gauge** ========================================================================================================================================== A gauge is a horizontal or vertical bar which shows a quantity (often time). :ref:`wx.Gauge` supports two working modes: determinate and indeterminate progress. The first is the usual working mode (see :meth:`~wx.Gauge.SetValue` and :meth:`~wx.Gauge.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 :meth:`~wx.Gauge.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). :ref:`wx.Gauge` supports dynamic switch between these two work modes. There are no user commands for the gauge. ^^ .. _Gauge-styles: |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. ^^ .. seealso:: :ref:`wx.Slider`, :ref:`wx.ScrollBar` | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class Gauge:
| |appearance| Control Appearance =============================== | .. figure:: _static/images/widgets/fullsize/wxmsw/wx.gauge.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: _static/images/widgets/fullsize/wxmac/wx.gauge.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: _static/images/widgets/fullsize/wxgtk/wx.gauge.png :alt: wxGTK :figclass: floatcenter **wxGTK** | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.Gauge.__init__` Default constructor. :meth:`~wx.Gauge.Create` Creates the gauge for two-step construction. :meth:`~wx.Gauge.GetClassDefaultAttributes` :meth:`~wx.Gauge.GetRange` Returns the maximum position of the gauge. :meth:`~wx.Gauge.GetValue` Returns the current position of the gauge. :meth:`~wx.Gauge.IsVertical` Returns ``True`` if the gauge is vertical (has ``GA_VERTICAL`` style) and ``False`` otherwise. :meth:`~wx.Gauge.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. :meth:`~wx.Gauge.SetRange` Sets the range (maximum value) of the gauge. :meth:`~wx.Gauge.SetValue` Sets the position of the gauge. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.Gauge.Range` See :meth:`~wx.Gauge.GetRange` and :meth:`~wx.Gauge.SetRange` :attr:`~wx.Gauge.Value` See :meth:`~wx.Gauge.GetValue` and :meth:`~wx.Gauge.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). .. method:: __init__(self, *args, **kw) |overload| Overloaded Implementations: :html:`

` **__init__** `(self)` Default constructor. :html:`

` **__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. :param `parent`: Window parent. :type `parent`: wx.Window :param `id`: Window identifier. :type `id`: wx.WindowID :param `range`: Integer range (maximum value) of the gauge. See :meth:`SetRange` for more details about the meaning of this value when using the gauge in indeterminate mode. :type `range`: int :param `pos`: Window position. :type `pos`: wx.Point :param `size`: Window size. :type `size`: wx.Size :param `style`: Gauge style. :type `style`: long :param `validator`: Window validator. :type `validator`: wx.Validator :param `name`: Window name. :type `name`: string .. seealso:: :meth:`Create` :html:`

` .. method:: 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 :ref:`wx.Gauge` for further details. :param `parent`: :type `parent`: wx.Window :param `id`: :type `id`: wx.WindowID :param `range`: :type `range`: int :param `pos`: :type `pos`: wx.Point :param `size`: :type `size`: wx.Size :param `style`: :type `style`: long :param `validator`: :type `validator`: wx.Validator :param `name`: :type `name`: string :rtype: `bool` .. staticmethod:: GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) :param `variant`: :type `variant`: wx.WindowVariant :rtype: :ref:`wx.VisualAttributes` .. method:: GetRange(self) Returns the maximum position of the gauge. :rtype: `int` .. seealso:: :meth:`SetRange` .. method:: GetValue(self) Returns the current position of the gauge. :rtype: `int` .. seealso:: :meth:`SetValue` .. method:: IsVertical(self) Returns ``True`` if the gauge is vertical (has ``GA_VERTICAL`` style) and ``False`` otherwise. :rtype: `bool` .. method:: 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 :meth:`GetValue` is undefined and thus you need to explicitly call :meth:`SetValue` if you want to restore the determinate mode. .. method:: 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. :param `range`: :type `range`: int .. seealso:: :meth:`GetRange` .. method:: SetValue(self, pos) Sets the position of the gauge. The `pos` must be between 0 and the gauge range as returned by :meth:`GetRange` , inclusive. This function makes the gauge switch to determinate mode, if it was in indeterminate mode before. :param `pos`: Position for the gauge level. :type `pos`: int .. seealso:: :meth:`GetValue` .. attribute:: Range See :meth:`~wx.Gauge.GetRange` and :meth:`~wx.Gauge.SetRange` .. attribute:: Value See :meth:`~wx.Gauge.GetValue` and :meth:`~wx.Gauge.SetValue`