diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2019-10-01 19:22:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-01 19:22:38 +0100 |
| commit | 5d45a00fe13f8291c63262b403046d00ad63f02b (patch) | |
| tree | 44e600ee3ab7332323767a064b5eeb99d2a05707 | |
| parent | f1135e977388458ee10215c840156460b03903c6 (diff) | |
| parent | 1094f66e2e32869b2c9dc937a7a7d2b5f55e1120 (diff) | |
| download | perlweeklychallenge-club-5d45a00fe13f8291c63262b403046d00ad63f02b.tar.gz perlweeklychallenge-club-5d45a00fe13f8291c63262b403046d00ad63f02b.tar.bz2 perlweeklychallenge-club-5d45a00fe13f8291c63262b403046d00ad63f02b.zip | |
Merge pull request #701 from choroba/ech28-2
Add solution to 028/2 (Digital clock) by E. Choroba
| -rwxr-xr-x | challenge-028/e-choroba/perl5/ch-2.pl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/challenge-028/e-choroba/perl5/ch-2.pl b/challenge-028/e-choroba/perl5/ch-2.pl new file mode 100755 index 0000000000..7376c02a57 --- /dev/null +++ b/challenge-028/e-choroba/perl5/ch-2.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl +use warnings; +use strict; + +use Time::Piece; +use Tk; + +my $time; +sub init_time { $time = localtime->strftime('%H:%M:%S') } + +my $rate = 500; + +my $mw = 'MainWindow'->new(-title => 'Digital Clock'); + +$mw->Label(-textvariable => \$time, + -font => 'Arial 48', +)->pack; + +my $repeat_id = $mw->repeat($rate, \&init_time); + +my $scale = $mw->Scale(-label => 'Refresh rate:', + -orient => 'horizontal', + -from => 1, + -to => 2000, + -command => sub { $repeat_id->time($rate = $_[0]) }, +)->pack; +$scale->set($rate); + +init_time(); +MainLoop(); |
