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

.. highlight:: python



.. _wx.lib.agw.pyprogress.PyProgress:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.pyprogress.PyProgress**
==========================================================================================================================================

:class:`PyProgress` is similar to :class:`ProgressDialog` in indeterminated mode, but with a
different gauge appearance and a different spinning behavior. The moving gauge
can be drawn with a single solid colour or with a shading gradient foreground.
The gauge background colour is user customizable.
The bar does not move always from the beginning to the end as in :class:`ProgressDialog`
in indeterminated mode, but spins cyclically forward and backward.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>PyProgress</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.agw.pyprogress.PyProgress_inheritance.png" alt="Inheritance diagram of PyProgress" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.agw.pyprogress.PyProgress.html" title="wx.lib.agw.pyprogress.PyProgress" alt="" coords="5,547,248,576"/> <area shape="rect" id="node2" href="wx.Dialog.html" title="wx.Dialog" alt="" coords="83,469,170,499"/> <area shape="rect" id="node3" href="wx.TopLevelWindow.html" title="wx.TopLevelWindow" alt="" coords="49,392,204,421"/> <area shape="rect" id="node4" href="wx.NonOwnedWindow.html" title="wx.NonOwnedWindow" alt="" coords="43,315,211,344"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window" alt="" coords="78,237,175,267"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="62,160,191,189"/> <area shape="rect" id="node7" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="68,83,185,112"/> <area shape="rect" id="node8" href="wx.Object.html" title="wx.Object" alt="" coords="23,5,110,35"/> <area shape="rect" id="node9" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="135,5,241,35"/> </map> 
   </p>
   </div>

|


|appearance| Control Appearance
===============================

|

.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.pyprogress.pyprogress.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.pyprogress.pyprogress.png
   :alt: wxGTK
   :figclass: floatcenter

   **wxGTK**


|




|super_classes| Known Superclasses
==================================

:class:`wx.Dialog`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.agw.pyprogress.PyProgress.__init__`                               Default class constructor.
:meth:`~wx.lib.agw.pyprogress.PyProgress.CreateLabel`                            Creates the :class:`StaticText` that holds the elapsed time label.
:meth:`~wx.lib.agw.pyprogress.PyProgress.DisableAbort`                           Disables the ``Cancel`` button.
:meth:`~wx.lib.agw.pyprogress.PyProgress.EnableAbort`                            Enables or disables the ``Cancel`` button.
:meth:`~wx.lib.agw.pyprogress.PyProgress.EnableClose`                            Enables or disables the ``Close`` button.
:meth:`~wx.lib.agw.pyprogress.PyProgress.GetAGWWindowStyleFlag`                  Returns the :class:`PyProgress` style.
:meth:`~wx.lib.agw.pyprogress.PyProgress.GetFirstGradientColour`                 Returns the gauge first gradient colour.
:meth:`~wx.lib.agw.pyprogress.PyProgress.GetGaugeBackground`                     Returns the gauge background colour.
:meth:`~wx.lib.agw.pyprogress.PyProgress.GetGaugeProportion`                     Returns the relative proportion between the sliding bar and the
:meth:`~wx.lib.agw.pyprogress.PyProgress.GetGaugeSteps`                          Returns the number of steps the gauge performs before switching from
:meth:`~wx.lib.agw.pyprogress.PyProgress.GetSecondGradientColour`                Returns the gauge second gradient colour.
:meth:`~wx.lib.agw.pyprogress.PyProgress.OnCancel`                               Handles the ``wx.EVT_BUTTON`` event for the dialog.
:meth:`~wx.lib.agw.pyprogress.PyProgress.OnClose`                                Handles the ``wx.EVT_CLOSE`` event for :class:`PyProgress`.
:meth:`~wx.lib.agw.pyprogress.PyProgress.OnDestroy`                              Handles the ``wx.EVT_WINDOW_DESTROY`` event for :class:`PyProgress`.
:meth:`~wx.lib.agw.pyprogress.PyProgress.ReenableOtherWindows`                   Re-enables the other windows if using :class:`wx.WindowDisabler`.
:meth:`~wx.lib.agw.pyprogress.PyProgress.SetFirstGradientColour`                 Sets the gauge first gradient colour.
:meth:`~wx.lib.agw.pyprogress.PyProgress.SetGaugeBackground`                     Sets the gauge background colour.
:meth:`~wx.lib.agw.pyprogress.PyProgress.SetGaugeProportion`                     Sets the relative proportion between the sliding bar and the
:meth:`~wx.lib.agw.pyprogress.PyProgress.SetGaugeSteps`                          Sets the number of steps the gauge performs before switching from
:meth:`~wx.lib.agw.pyprogress.PyProgress.SetSecondGradientColour`                Sets the gauge second gradient colour.
:meth:`~wx.lib.agw.pyprogress.PyProgress.SetTimeLabel`                           Sets the elapsed time label.
:meth:`~wx.lib.agw.pyprogress.PyProgress.ShowDialog`                             Show the dialog.
:meth:`~wx.lib.agw.pyprogress.PyProgress.UpdatePulse`                            Updates the dialog, setting the progress bar to the new value and, if given
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: PyProgress(wx.Dialog)

   :class:`PyProgress` is similar to :class:`ProgressDialog` in indeterminated mode, but with a
   different gauge appearance and a different spinning behavior. The moving gauge
   can be drawn with a single solid colour or with a shading gradient foreground.
   The gauge background colour is user customizable.
   The bar does not move always from the beginning to the end as in :class:`ProgressDialog`
   in indeterminated mode, but spins cyclically forward and backward.

   .. method:: __init__(self, parent=None, id=-1, title="", message="", agwStyle=wx.PD_APP_MODAL|wx.PD_AUTO_HIDE)

      Default class constructor.
      
      :param `parent`: parent window;
      :param `id`: window identifier. A value of -1 indicates a default value;
      :param `title`: dialog title to show in titlebar;
      :param `message`: message displayed above the progress bar;
      :param `style`: the dialog style. This can be a combination of the following bits:
      
       =================== =========== ==================================================
       Window Styles       Hex Value   Description
       =================== =========== ==================================================
       ``PD_CAN_ABORT``            0x1 This flag tells the dialog that it should have a ``Cancel`` button which the user may press. If this happens, the next call to `UpdatePulse` will return ``False``.
       ``PD_APP_MODAL``            0x2 Make the progress dialog modal. If this flag is not given, it is only 'locally' modal - that is the input to the parent window is disabled, but not to the other ones.
       ``PD_AUTO_HIDE``            0x4 Causes the progress dialog to disappear from screen as soon as the maximum value of the progress meter has been reached.
       ``PD_ELAPSED_TIME``         0x8 This flag tells the dialog that it should show elapsed time (since creating the dialog).
       =================== =========== ==================================================


   .. method:: CreateLabel(self, text, sizer)

      Creates the :class:`StaticText` that holds the elapsed time label.
      
      :param `text`: the dialog message to be displayed above the gauge;
      :param `sizer`: the main :class:`BoxSizer` for :class:`PyProgress`.


   .. method:: DisableAbort(self)

      Disables the ``Cancel`` button. 


   .. method:: EnableAbort(self, enable=True)

      Enables or disables the ``Cancel`` button.
      
      :param `enable`: ``True`` to enable the ``Cancel`` button, ``False`` to disable it.


   .. method:: EnableClose(self, enable=True)

      Enables or disables the ``Close`` button.
      
      :param `enable`: ``True`` to enable the ``Close`` button, ``False`` to disable it.


   .. method:: GetAGWWindowStyleFlag(self)

      Returns the :class:`PyProgress` style.
      
      :see: The :meth:`~PyProgress.__init__` method for a list of possible style flags.


   .. method:: GetFirstGradientColour(self)

      Returns the gauge first gradient colour. 


   .. method:: GetGaugeBackground(self)

      Returns the gauge background colour. 


   .. method:: GetGaugeProportion(self)

      Returns the relative proportion between the sliding bar and the
      whole gauge.


   .. method:: GetGaugeSteps(self)

      Returns the number of steps the gauge performs before switching from
      forward to backward (or vice-versa) movement.


   .. method:: GetSecondGradientColour(self)

      Returns the gauge second gradient colour. 


   .. method:: OnCancel(self, event)

      Handles the ``wx.EVT_BUTTON`` event for the dialog.
      
      :param `event`: a :class:`CommandEvent` event to be processed.
      
      :note: This method handles the ``Cancel`` button press.


   .. method:: OnClose(self, event)

      Handles the ``wx.EVT_CLOSE`` event for :class:`PyProgress`.
      
      :param `event`: a :class:`CloseEvent` event to be processed.


   .. method:: OnDestroy(self, event)

      Handles the ``wx.EVT_WINDOW_DESTROY`` event for :class:`PyProgress`.
      
      :param `event`: a :class:`wx.WindowDestroyEvent` event to be processed.


   .. method:: ReenableOtherWindows(self)

      Re-enables the other windows if using :class:`wx.WindowDisabler`. 


   .. method:: SetFirstGradientColour(self, colour)

      Sets the gauge first gradient colour.
      
      :param `colour`: a valid :class:`wx.Colour` object.


   .. method:: SetGaugeBackground(self, colour)

      Sets the gauge background colour.
      
      :param `colour`: a valid :class:`wx.Colour` object.


   .. method:: SetGaugeProportion(self, proportion)

      Sets the relative proportion between the sliding bar and the
      whole gauge.
      
      :param `proportion`: a floating point number representing the relative
       proportion between the sliding bar and the whole gauge.


   .. method:: SetGaugeSteps(self, steps)

      Sets the number of steps the gauge performs before switching from
      forward to backward (or vice-versa) movement.
      
      :param `steps`: the number of steps the gauge performs before switching from
       forward to backward (or vice-versa) movement.


   .. method:: SetSecondGradientColour(self, colour)

      Sets the gauge second gradient colour.
      
      :param `colour`: a valid :class:`wx.Colour` object.


   .. method:: SetTimeLabel(self, val, label=None)

      Sets the elapsed time label.
      
      :param `val`: the elapsed time since the dialog was shown, in seconds;
      :param `label`: the new message to display in the elapsed time text.


   .. method:: ShowDialog(self, show=True)

      Show the dialog.
      
      :param `show`: ``True`` to show the dialog and re-enable all the other windows,
       ``False`` otherwise.


   .. method:: UpdatePulse(self, newmsg="")

      Updates the dialog, setting the progress bar to the new value and, if given
      changes the message above it. Returns ``True`` unless the ``Cancel`` button
      has been pressed.
      
      If ``False`` is returned, the application can either immediately destroy the
      dialog or ask the user for the confirmation.
      
      :param `newmsg`: The new messages for the progress dialog text, if it is
       empty (which is the default) the message is not changed.


