AGW Logo

agw_title PyProgress

PyProgress is similar to wx.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 wx.ProgressDialog in indeterminated mode, but spins cyclically forward and backward.

hierarchy Inheritance Diagram

Inheritance diagram for: PyProgress

Inheritance diagram of PyProgress


appearance Control Appearance


PyProgress

PyProgress


method_summary Methods Summary

__init__Default class constructor.
CreateLabelCreates the wx.StaticText that holds the elapsed time label.
DisableAbortDisables the Cancel button.
EnableAbortEnables or disables the Cancel button.
EnableCloseEnables or disables the Close button.
GetFirstGradientColourReturns the gauge first gradient colour.
GetGaugeBackgroundReturns the gauge background colour.
GetGaugeProportionReturns the relative proportion between the sliding bar and the
GetGaugeStepsReturns the number of steps the gauge performs before switching from
GetSecondGradientColourReturns the gauge second gradient colour.
OnCancelHandles the wx.EVT_BUTTON event for the dialog.
OnCloseHandles the wx.EVT_CLOSE event for PyProgress.
OnDestroyHandles the wx.EVT_WINDOW_DESTROY event for PyProgress.
ReenableOtherWindowsRe-enables the other windows if using wx.WindowDisabler.
SetFirstGradientColourSets the gauge first gradient colour.
SetGaugeBackgroundSets the gauge background colour.
SetGaugeProportionSets the relative proportion between the sliding bar and the whole gauge.
SetGaugeStepsSets the number of steps the gauge performs before switching from forward to backward (or vice-versa) movement.
SetSecondGradientColourSets the gauge second gradient colour.
SetTimeLabelSets the elapsed time label.
ShowDialogShow the dialog.
UpdatePulseUpdates the dialog, setting the progress bar to the new value and, if given changes the message above it.

API Class API

class PyProgress(wx.Dialog)[source]

PyProgress is similar to wx.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 wx.ProgressDialog in indeterminated mode, but spins cyclically forward and backward.



__init__(parent=None, id=-1, title="", message="", agwStyle=wx.PD_APP_MODAL|wx.PD_AUTO_HIDE)[source]

Default class constructor.

Parameters:
  • parent – parent window;
  • id – window identifier. A value of -1 indicates a default value;
  • title – dialog title to show in titlebar;
  • message – message displayed above the progress bar;
  • 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).


CreateLabel(text, sizer)[source]

Creates the wx.StaticText that holds the elapsed time label.

Parameters:
  • text – the dialog message to be displayed above the gauge;
  • sizer – the main wx.BoxSizer for PyProgress.


DisableAbort()[source]

Disables the Cancel button.



EnableAbort(enable=True)[source]

Enables or disables the Cancel button.

Parameters:enableTrue to enable the Cancel button, False to disable it.


EnableClose(enable=True)[source]

Enables or disables the Close button.

Parameters:enableTrue to enable the Close button, False to disable it.


GetFirstGradientColour()[source]

Returns the gauge first gradient colour.



GetGaugeBackground()[source]

Returns the gauge background colour.



GetGaugeProportion()[source]

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



GetGaugeSteps()[source]

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



GetSecondGradientColour()[source]

Returns the gauge second gradient colour.



OnCancel(event)[source]

Handles the wx.EVT_BUTTON event for the dialog.

Parameters:event – a wx.CommandEvent event to be processed.

Note

This method handles the Cancel button press.



OnClose(event)[source]

Handles the wx.EVT_CLOSE event for PyProgress.

Parameters:event – a wx.CloseEvent event to be processed.


OnDestroy(event)[source]

Handles the wx.EVT_WINDOW_DESTROY event for PyProgress.

Parameters:event – a wx.WindowDestroyEvent event to be processed.


ReenableOtherWindows()[source]

Re-enables the other windows if using wx.WindowDisabler.



SetFirstGradientColour(colour)[source]

Sets the gauge first gradient colour.

Parameters:colour – a valid wx.Colour object.


SetGaugeBackground(colour)[source]

Sets the gauge background colour.

Parameters:colour – a valid wx.Colour object.



SetGaugeProportion(proportion)[source]

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

Parameters:proportion – a floating point number representing the relative proportion between the sliding bar and the whole gauge.


SetGaugeSteps(steps)[source]

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

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


SetSecondGradientColour(colour)[source]

Sets the gauge second gradient colour.

Parameters:colour – a valid wx.Colour object.



SetTimeLabel(val, label=None)[source]

Sets the elapsed time label.

Parameters:
  • val – the elapsed time since the dialog was shown, in seconds;
  • label – the new message to display in the elapsed time text.


ShowDialog(show=True)[source]

Show the dialog.

Parameters:showTrue to show the dialog and re-enable all the other windows, False otherwise.


UpdatePulse(newmsg='')[source]

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.

Parameters:newmsg – The new messages for the progress dialog text, if it is empty (which is the default) the message is not changed.
Tree

Table Of Contents

Previous topic

ProgressGauge

Next topic

SVN Revision 68362 For pyprogress