1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#!/usr/bin/perl
use v5.20;
use warnings;
use Tickit;
use Tickit::Widgets qw( Spinner Button HBox VBox );
my $vbox = Tickit::Widget::VBox->new;
$vbox->add( my $spinner = Tickit::Widget::Spinner->new(
chars => [ map { substr( "-=X=- -=X=-", 9-$_, 10 ) } 0 .. 9 ],
interval => 0.1,
),
expand => 3,
);
$vbox->add( my $hbox = Tickit::Widget::HBox->new,
expand => 1,
);
$hbox->add(
Tickit::Widget::Button->new( label => "Start", on_click => sub { $spinner->start } ),
expand => 1
);
$hbox->add(
Tickit::Widget::Button->new( label => "Stop", on_click => sub { $spinner->stop } ),
expand => 1,
);
Tickit->new( root => $vbox )->run;
|