Curses::UI::Number - Create and manipulate number widgets.
Curses::UI::Widget | +----Curses::UI::Label | +----Curses::UI::Number
use Curses::UI; my $win = $cui->add('window_id', 'Window'); my $number = $win->add( 'mynum', 'Curses::UI::Number', -num => 5, ); $number->draw;
Curses::UI::Number is a widget that shows a number in graphic form.
-parent, -x, -y, -width, -height, -pad, -padleft, -padright, -padtop, -padbottom, -ipad, -ipadleft, -ipadright, -ipadtop, -ipadbottom, -title, -titlefullwidth, -titlereverse, -onfocus, -onblur.
-parent
-x
-y
-width
-height
-pad
-padleft
-padright
-padtop
-padbottom
-ipad
-ipadleft
-ipadright
-ipadtop
-ipadbottom
-title
-titlefullwidth
-titlereverse
-onfocus
-onblur
For an explanation of these standard options, see Curses::UI::Widget.
-text.
-text
-num < NUMBER >
-num
Number. Default value is undef.
-char < CHARACTER >
-char
Character for Curses::UI::Number drawing. Default value is '█'.
layout, draw, intellidraw, focus, onFocus, onBlur.
layout
draw
intellidraw
focus
onFocus
onBlur
For an explanation of these standard methods, see Curses::UI::Widget.
new(%parameters)
Constructor. Create widget with volume in graphic form, defined by -volume number. Returns object.
num([$number])
Get or set number. Returns number (0 - 9).
use strict; use warnings; use Curses::UI; # Object. my $cui = Curses::UI->new; # Main window. my $win = $cui->add('window_id', 'Window'); # Add volume. $win->add( undef, 'Curses::UI::Number', '-num' => 5, ); # Binding for quit. $win->set_binding(\&exit, "\cQ", "\cC"); # Loop. $cui->mainloop; # Output like: # ██████ # ██ # ██████ # ██ # ██████
use strict; use warnings; use Curses::UI; # Object. my $cui = Curses::UI->new( -color_support => 1, ); # Main window. my $win = $cui->add('window_id', 'Window'); # Add number. my $num = $win->add( undef, 'Curses::UI::Number', '-border' => 1, '-num' => 0, ); # Binding for quit. $win->set_binding(\&exit, "\cQ", "\cC"); # Time. $cui->set_timer( 'timer', sub { my $act = $num->num; $act += 1; if ($act > 9) { $act = 0; } $num->num($act); return; }, 1, ); # Loop. $cui->mainloop; # Output like: # ┌──────┐ # │██████│ # │██ ██│ # │██████│ # │██ ██│ # │██████│ # └──────┘
Curses::UI::Common, Curses::UI::Label, Curses::UI::Widget, Unicode::UTF8.
Install the Curses::UI modules.
https://github.com/michal-josef-spacek/Curses-UI-Number
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2014-2015 Michal Josef Špaček
BSD 2-Clause License
To Czech Perl Workshop 2014 and their organizers.
0.07
To install Curses::UI::Number, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Curses::UI::Number
CPAN shell
perl -MCPAN -e shell install Curses::UI::Number
For more information on module installation, please visit the detailed CPAN module installation guide.