Last active
January 6, 2021 15:09
-
-
Save ology/234176a2d8cbc2a329eb4232eead2c9c to your computer and use it in GitHub Desktop.
Windows Shire Time Display
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://ology.net/tmp/shire.bmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl | |
# http://ology.net/tmp/shire.bmp | |
use strict; | |
use warnings; | |
use Win32::GUI (); | |
use Date::Tolkien::Shire (); | |
#use Time::Local qw(timelocal); | |
#use Test::Time time => timelocal(0,0,0,5,0,2021); | |
use constant DEBUG => 0; | |
my $DOS = Win32::GUI::GetPerlWindow(); | |
unless (DEBUG) { | |
Win32::GUI::Hide($DOS); | |
} | |
my $image = Win32::GUI::Bitmap->new('shire.bmp'); | |
die 'Could not find shire bitmap' unless $image; | |
my ($width, $height) = $image->Info; | |
my $main = Win32::GUI::Window->new( | |
-name => 'Shire Time', | |
-text => 'Shire Time', | |
-left => 0, | |
-top => 0, | |
-height => $height, | |
-width => $width, | |
); | |
my $bitmap = $main->AddLabel( | |
-name => 'Bitmap', | |
-left => 0, | |
-top => 0, | |
-height => $height, | |
-width => $width, | |
-bitmap => $image, | |
); | |
$main->Center; | |
$main->Show; | |
my $dts = Date::Tolkien::Shire->new(time()); | |
my $on_date = $dts->on_date; | |
$on_date =~ s/\n/\r\n/g; | |
my $text = $main->AddTextfield( | |
-text => $on_date, | |
-left => 200, | |
-top => 50, | |
-height => 100, | |
-width => $width - 2 * 200, | |
-multiline => 1, | |
-readonly => 1, | |
-align => 'center', | |
); | |
Win32::GUI::Dialog(); | |
unless (DEBUG) { | |
Win32::GUI::Show($DOS); | |
} | |
exit(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment