Prima::Spinner - Show a spinner animation


  use Prima qw(Application Buttons Spinner);

  my $mw = Prima::MainWindow->new(
                size => [200, 400],
                text => 'Button Example');

  my $spinner = $mw->insert('Spinner',
        style => 'drops',
        size => [200,400],
        growMode => gm::Center

  my $button = $mw->insert(
        text => 'Start/Stop',
        checkable => 1,
        checked => 1,
        origin => [0,0],
        onClick => sub { $spinner->toggle },
        growMode => gm::XCenter

  run Prima;


Prima::Spinner provides a simple spinning animation with two designs and the opportunity to specify the colors of the spinning animation. This is useful to show an indeterminate progress of a running process.


You can determine the following properties:


active [BOOLEAN]

If now parameter is passed, by this method you can get the active state of the spinning widget. '1' means that the spinner is running, '0' that it is stopped. With active(1) you can start the spinner animation, with active(0) you can stop it.

color COLOR

Inherited from Prima::Widget. color manages the basic foreground color. Concrete for the spinner widget this means the background color of the circle or the color of the active drops.

hiliteColor COLOR

Inherited from Prima::Widget. The color used to draw alternate foreground areas with high contrast. For the spinner widget this means the color of the arc. Only for circle style.

showPercent BOOLEAN

If set, displays completion percent as text. Only for circle style.


Same as active(1)


Same as active(0)

style STRING

style can be 'drops', 'circle' or 'spiral'. 'drops' shows drops that switches consecutively the color. With 'circle' an arc moving around a circle is shown. 'spiral' shows a spinning spiral. The default is 'drops'.

value INT

Integer between 0 and 100, showing completion perentage. Only for circle style.


Same as active(!active)


Prima. Prima::Widget, examples/


Maximilian Lika


Copyright (C) 2017 by Maximilian Lika

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.22.2 or, at your option, any later version of Perl 5 you may have available.