Tk::TimePick - Perl extension for a graphical user interface to pick timestrings syntax mistake-secure
use Tk; use Tk::TimePick; my $mw = MainWindow->new(); my $tp = $mw->TimePick()->pack(); my $b = $mw->Button( -text => "Time", -command => sub { my $time_as_string = $tp->GetTimeString(); # my $time_as_string = $tp->GetTime(); #*** # Here we do something with the time as string #*** } )->pack(); MainLoop();
The module protect the application for syntax-mistakes, made by users, while insert time specifications.
use Tk; use Tk::TimePick; my $mw = MainWindow->new(); my $tp = $mw->TimePick( -order => "smh", # default = "hms" -separator => "<>", # default = ':' -maxhours => 12, # default = 23 -seconds => 30, # default = (localtime())[0] -minutes => 30, # default = (localtime())[1] -hours => 12, # default = (localtime())[2] -regextimeformat => qr/regex for time-string/ # default = qr/(\d{1,2})(.+?)(\d{1,2})(.+?)(\d{1,2})/o )->pack(); $tp->Subwidget("EntryTime")->configure( -font => "{Times New Roman} 18 {bold}" ); for(qw/ ButtonSecondsReduce ButtonSecondsIncrease ButtonMinutesReduce ButtonMinutesIncrease ButtonHoursReduce ButtonHoursIncrease /) { $tp->Subwidget($_)->configure( -font => "{Times New Roman} 14 {bold}", ); } for(qw/ FrameSeconds FrameMinutes FrameHours /) { $tp->Subwidget($_)->configure( -background => "#00FF00" ); } MainLoop();
The order of hours, minutes and seconds. h = hours, m = minutes, s = seconds "hms" = hours:minutes:seconds (default = "hms")
char or string between the numbers (default = ':')
times in 23 or 12 hours (default = 23)
at the beginning indicated seconds
at the beginning indicated minutes
at the beginning indicated hours
a regular expression that fits onto the time format (default = qr/(\d{1,2})(.+?)(\d{1,2})(.+?)(\d{1,2})/o)
shows the time no direct user inputs are possible
contains the two buttons "ButtonSecondsReduce" and "ButtonSecondsIncrease"
reduce the seconds
increase the seconds
contains the two buttons "ButtonMinutesReduce" and "ButtonMinutesIncrease"
reduce the minutes
increase the minutes
contains the two buttons "ButtonHoursReduce" and "ButtonHoursIncrease"
reduce the hours
increase the hours
None by default.
Tk::DatePick http://www.planet-interkom.de/t.knorr/index.html torstenknorr@tiscali.de
time, user interface,
Maybe you'll find some. Please let me know.
Torsten Knorr, <torstenknorr@tiscali.de>
Copyright (C) 2006 by Torsten Knorr
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.9.2 or, at your option, any later version of Perl 5 you may have available.
8 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
You forgot a '=back' before '=head1'
You forgot a '=back' before '=head2'
To install Tk::TimePick, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tk::TimePick
CPAN shell
perl -MCPAN -e shell install Tk::TimePick
For more information on module installation, please visit the detailed CPAN module installation guide.