Wx::Perl::Throbber - An animated throbber/spinner
use Wx::Perl::Throbber; my @frames; foreach ('1.gif', '2.gif', '3.gif') { push @frames, new Wx::Bitmap($_, wxBITMAP_TYPE_ANY); } my $throbber = new Wx::Perl::Throbber($parent, -1, \@frames, $pos, $size); $throbber->SetLabel('Please Wait'); $throbber->ShowLabel(1); $throbber->Start(); ... $throbber->Rest(); # or Stop()
This control is based on the Python library wx.throbber.
A throbber displays an animated image that can be started, stopped, reversed, etc. Useful for showing an ongoing process (like most web browsers use) or simply for adding eye-candy to an application.
Throbbers utilize a Wx::Timer so that normal processing can continue unencumbered.
$parent (parent window) $id = -1 (window identifier) $bitmap = undef (throbber bitmap. see SetBitmap()) $position = wxDefaultPosition (window position) $size = wxDefaultSize (window size) $frameDelay = 75 (milliseconds. See SetFrameDelay) $frames = undef (number of frames. see SetBitmap()) $framesWidth = undef (width of frames. see SetBitmap()) $label = '' (text label. see SetLabel()) $overlay = undef (overlay bitmap. see SetOverlay()) $reverse = 0 (auto-reverse) $style = undef (window style) $name = "throbber" (window name)
$bitmap is either a single Wx::Bitmap that will be split into frames (a composite image) or a list of Wx::Bitmap objects that will be treated as individual frames.
$bitmap
Wx::Bitmap
If a single (composite) image is given, then additional information must be provided: the number of frames in the image ($frames) and the width of each frame ($framesWidth).
$frames
$framesWidth
The first frame is treated as the "at rest" frame (it is not shown during animation, but only when Rest() is called.
Rest()
Set the delay between frames in milliseconds
Default is 75 milliseconds
Returns the frame delay
Start the animation
Stop the animation
Stop the animation and return to the rest frame (frame 0)
Returns true if the animation is running
true
Returns the frame index that is currently displayed. Starts at 0 (the rest frame)
Returns the number of frames in the animation (excluding the rest frame)
Change the direction of the animation
Turn on/off auto-reverse. When auto-reverse is set, the throbber will change direction when it reaches the start/end of the animation. Otherwise it jumps back to the beginning.
Get the auto-reverse state
Sets an overlay bitmap to be displayed above the throbber animation
Returns a copy of the overlay bitmap set for the throbber
Set true/false whether the overlay bitmap is shown
Set the text of the label. The text label appears above the throbber animation and overlay (if applicable)
Returns the label set for the throbber
Set true/false whether the text label is shown
Set the font for the label. Expects a Wx::Font object.
This event is processed while the throbber is running, every $frameDelay milliseconds
This function is exported on request:
use Wx::Perl::Throbber 'EVT_UPDATE_THROBBER';
Simon Flack
This module is released under the wxWindows/GPL license
Wx::Perl::Throbber is based on the Python library wx.throbber by Cliff Wells
To install Wx::Perl::Throbber, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Wx::Perl::Throbber
CPAN shell
perl -MCPAN -e shell install Wx::Perl::Throbber
For more information on module installation, please visit the detailed CPAN module installation guide.