.. 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 .. currentmodule:: wx.lib.agw.pygauge .. highlight:: python .. _wx.lib.agw.pygauge.PyGauge: ========================================================================================================================================== |phoenix_title| **wx.lib.agw.pygauge.PyGauge** ========================================================================================================================================== This class provides a visual alternative for :class:`Gauge`. It currently only support determinate mode (see :meth:`PyGauge.SetValue() ` and :meth:`PyGauge.SetRange() `). | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class PyGauge:
| |appearance| Control Appearance =============================== | .. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.pygauge.pygauge.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: _static/images/widgets/fullsize/wxgtk/wx.lib.agw.pygauge.pygauge.png :alt: wxGTK :figclass: floatcenter **wxGTK** | |super_classes| Known Superclasses ================================== :class:`wx.Window` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.agw.pygauge.PyGauge.__init__` Default class constructor. :meth:`~wx.lib.agw.pygauge.PyGauge.DoGetBestSize` Gets the size which best suits :class:`PyGauge`: for a control, it would be :meth:`~wx.lib.agw.pygauge.PyGauge.GetBarColour` Returns the :class:`PyGauge` main bar colour. :meth:`~wx.lib.agw.pygauge.PyGauge.GetBarGradient` Returns a tuple containing the gradient start and end colours. :meth:`~wx.lib.agw.pygauge.PyGauge.GetBorderColour` Returns the :class:`PyGauge` border colour. :meth:`~wx.lib.agw.pygauge.PyGauge.GetBorderPadding` Gets the border padding. :meth:`~wx.lib.agw.pygauge.PyGauge.GetRange` Returns the maximum value of the gauge. :meth:`~wx.lib.agw.pygauge.PyGauge.GetValue` Returns the current position of the gauge. :meth:`~wx.lib.agw.pygauge.PyGauge.OnEraseBackground` Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`PyGauge`. :meth:`~wx.lib.agw.pygauge.PyGauge.OnPaint` Handles the ``wx.EVT_PAINT`` event for :class:`PyGauge`. :meth:`~wx.lib.agw.pygauge.PyGauge.OnTimer` Handles the ``wx.EVT_TIMER`` event for :class:`PyGauge`. :meth:`~wx.lib.agw.pygauge.PyGauge.SetBarColour` Sets the :class:`PyGauge` main bar colour. :meth:`~wx.lib.agw.pygauge.PyGauge.SetBarGradient` Sets the bar gradient. :meth:`~wx.lib.agw.pygauge.PyGauge.SetBorderColour` Sets the :class:`PyGauge` border colour. :meth:`~wx.lib.agw.pygauge.PyGauge.SetBorderPadding` Sets the border padding. :meth:`~wx.lib.agw.pygauge.PyGauge.SetDrawValue` Sets whether percentage or current value should be drawn on the gauge for precise indication. :meth:`~wx.lib.agw.pygauge.PyGauge.SetRange` Sets the range of the gauge. The gauge length is its :meth:`~wx.lib.agw.pygauge.PyGauge.SetValue` Sets the current position of the gauge. :meth:`~wx.lib.agw.pygauge.PyGauge.SortForDisplay` Internal method which sorts things so we draw the longest bar first. :meth:`~wx.lib.agw.pygauge.PyGauge.Update` Update the gauge by adding `value` to it over `time` milliseconds. The `time` parameter ================================================================================ ================================================================================ | |api| Class API =============== .. class:: PyGauge(wx.Window) This class provides a visual alternative for :class:`Gauge`. It currently only support determinate mode (see :meth:`PyGauge.SetValue() ` and :meth:`PyGauge.SetRange() `). .. method:: __init__(self, parent, id=wx.ID_ANY, range=100, pos=wx.DefaultPosition, size=(-1,30), style=0) Default class constructor. :param `parent`: parent window. Must not be ``None``; :param `id`: window identifier. A value of -1 indicates a default value; :param `pos`: the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform; :param `size`: the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform; :param `style`: the underlying :class:`wx.Window` window style. .. method:: DoGetBestSize(self) Gets the size which best suits :class:`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 :class:`wx.Window`. .. method:: GetBarColour(self) Returns the :class:`PyGauge` main bar colour. .. method:: GetBarGradient(self) Returns a tuple containing the gradient start and end colours. .. method:: GetBorderColour(self) Returns the :class:`PyGauge` border colour. .. method:: GetBorderPadding(self) Gets the border padding. .. method:: GetRange(self) Returns the maximum value of the gauge. .. method:: GetValue(self) Returns the current position of the gauge. .. method:: OnEraseBackground(self, event) Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`PyGauge`. :param `event`: a :class:`EraseEvent` event to be processed. .. note:: This method is intentionally empty to reduce flicker. .. method:: OnPaint(self, event) Handles the ``wx.EVT_PAINT`` event for :class:`PyGauge`. :param `event`: a :class:`PaintEvent` event to be processed. .. method:: OnTimer(self,event) Handles the ``wx.EVT_TIMER`` event for :class:`PyGauge`. :param `event`: a :class:`TimerEvent` event to be processed. .. method:: SetBarColour(self, colour) Sets the :class:`PyGauge` main bar colour. :param `colour`: an instance of :class:`wx.Colour`. .. method:: SetBarGradient(self, gradient) Sets the bar gradient. :param `gradient`: a tuple containing the gradient start and end colours. .. note:: This overrides the bar colour previously set with :meth:`PyGauge.SetBarColour`. .. method:: SetBorderColour(self, colour) Sets the :class:`PyGauge` border colour. :param `colour`: an instance of :class:`wx.Colour`. .. method:: SetBorderPadding(self, padding) Sets the border padding. :param `padding`: pixels between the border and the progress bar. .. method:: 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. :param bool `draw`: 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; :param bool `drawPercent`: a boolean value which indicates that a percent should be drawn instead of value passed in :meth:`SetValue`; :param wx.Font `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; :param wx.Colour `colour`: the colour with which indication should be drawn, if ``None`` then ``wx.BLACK`` will be used; :param string `formatString`: a string specifying format of the indication (should have one and only one number placeholder). If set to ``None``, will use ``{:.0f}`` format string for values and ``{:.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``. .. versionadded:: 0.9.7 .. method:: SetRange(self, range) Sets the range of the gauge. The gauge length is its value as a proportion of the range. :param `range`: The maximum value of the gauge. .. method:: SetValue(self, value) Sets the current position of the gauge. :param `value`: an integer specifying the current position of the gauge. .. method:: SortForDisplay(self) Internal method which sorts things so we draw the longest bar first. .. method:: 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. :param `value`: The value to be added to the gauge; :param `time`: The length of time in milliseconds that it will take to move the gauge.