# wx.lib.throbber.Throbber¶

The first argument is either the name of a file that will be split into frames (a composite image) or a list of strings of image names that will be treated as individual frames. If a single (composite) image is given, then additional information must be provided: the number of frames in the image and the width of each frame. The first frame is treated as the “at rest” frame (it is not shown during animation, but only when Throbber.Rest() is called. A second, single image may be optionally specified to overlay on top of the animation. A label may also be specified to show on top of the animation.

## Class Hierarchy¶

Inheritance diagram for class Throbber:

## Known Superclasses¶

wx.Panel

## Methods Summary¶

 __init__ Default class constructor. Decrement Display previous image in sequence. DoGetBestSize Get the best size of the widget. Draw Draw the widget. Increment Display next image in sequence. Next Display next image in sequence according to direction. OnDestroyWindow Handles the wx.EVT_WINDOW_DESTROY event for Throbber. OnPaint Handles the wx.EVT_PAINT event for Throbber. OnTimer Handles the wx.EVT_TIMER event for Throbber. Previous Display previous image in sequence according to direction. Rest Stop the animation and return to frame 0. Reverse Change the direction of the animation. Running Returns True if the animation is running. SetCurrent Set current image. SetFont Set the font for the label. SetFrameDelay Delay between each frame. SetLabel Change the text of the label. SetRest Set rest image. SetSequence Order to display images in. Start Start the animation. Stop Stop the animation. ToggleLabel Toggle the label. ToggleOverlay Toggle the overlay image. Update Handles the EVT_UPDATE_THROBBER event for ResizeWidget. Wrap Wrap the throbber around.

## Class API¶

class Throbber(wx.Panel)

The first argument is either the name of a file that will be split into frames (a composite image) or a list of strings of image names that will be treated as individual frames. If a single (composite) image is given, then additional information must be provided: the number of frames in the image and the width of each frame. The first frame is treated as the “at rest” frame (it is not shown during animation, but only when Throbber.Rest() is called. A second, single image may be optionally specified to overlay on top of the animation. A label may also be specified to show on top of the animation.

### Methods¶

__init__(self, parent, id, bitmap, pos = wx.DefaultPosition, size = wx.DefaultSize, frameDelay = 0.1, frames = 0, frameWidth = 0, label = None, overlay = None, reverse = 0, style = 0, name = "throbber", rest = 0, current = 0, direction = 1, sequence = None)

Default class constructor.

Parameters
• parent – parent window, must not be None

• id (integer) – window identifier. A value of -1 indicates a default value

• bitmap – a wx.Bitmap to be used

• pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform

• size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform

• frameDelay – time delay between frames

• frames – number of frames (only necessary for composite image)

• frameWidth – width of each frame (only necessary for composite image)

• label (string) – optional text to be displayed

• overlay – optional wx.Bitmap to overlay on animation

• reverse (boolean) – reverse direction at end of animation

• style (integer) – the underlying wx.Control style

• name (string) – the widget name.

• rest – the rest frame

• current – the current frame

• direction – 1 advances = -1 reverses

• sequence – sequence of frames, defaults to range(self.frames)

Decrement(self)

Display previous image in sequence.

DoGetBestSize(self)

Returns

the width and height

Draw(self, dc)

Draw the widget.

Parameters

dc – the wx.DC to draw on

Increment(self)

Display next image in sequence.

Next(self)

Display next image in sequence according to direction.

OnDestroyWindow(self, event)

Handles the wx.EVT_WINDOW_DESTROY event for Throbber.

Parameters

event – a wx.WindowDestroyEvent event to be processed.

OnPaint(self, event)

Handles the wx.EVT_PAINT event for Throbber.

Parameters

event – a PaintEvent event to be processed.

OnTimer(self, event)

Handles the wx.EVT_TIMER event for Throbber.

Parameters

event – a TimerEvent event to be processed.

Previous(self)

Display previous image in sequence according to direction.

Rest(self)

Reverse(self)

Change the direction of the animation.

Running(self)

Returns True if the animation is running.

SetCurrent(self, current)

Set current image.

Parameters

current (int) – the index to the current image

SetFont(self, font)

Set the font for the label.

Parameters

font – the wx.Font to use

SetFrameDelay(self, frameDelay = 0.05)

Delay between each frame.

Parameters

frameDelay (float) – the delay between frames.

SetLabel(self, label)

Change the text of the label.

Parameters

label (string) – the label text.

SetRest(self, rest)

Set rest image.

Parameters

rest (int) – the index for the rest frame.

SetSequence(self, sequence = None)

Order to display images in.

Parameters

sequence – a sequence containing the order to display images in.

Start(self)

Start the animation.

Stop(self)

Stop the animation.

ToggleLabel(self, state = None)

Toggle the label.

Parameters

state (boolean) – set the label state or if None toggle state.

ToggleOverlay(self, state = None)

Toggle the overlay image.

Parameters

state (boolean) – set the overlay state or if None toggle state.

Update(self, event)

Handles the EVT_UPDATE_THROBBER event for ResizeWidget.

Parameters

event – a UpdateThrobberEvent event to be processed.

Wrap(self)

Wrap the throbber around.