Just for practice, I coded up a Perl/Tk clone (actually, as jcwren pointed out, I didn't write a clone of *Perl/Tk*, but a Fortune clone IN Perl/Tk). The only problem is that every time you get a new fortune, the window frame resizes itself...oh well, maybe next version. Any pointers would be appreciated.
#!/usr/bin/perl -w
use strict;
use Tk;
my $fortune;
my $fortune_label;
my $mw = MainWindow -> new;
$mw -> title("FortuneTk");
$mw -> Button(-text => "Exit", -command => sub { &exit })
-> pack (-side => 'bottom');
$mw -> Button(-text => 'Next Fortune', command => sub { &get_fortune }
+)
-> pack (-side => 'bottom');
$fortune_label = $mw -> Label()
-> pack(-side => 'top', -ipadx => '130', -ipady =>
'90');
MainLoop;
sub get_fortune {
$fortune = `/usr/games/fortune`;
$fortune_label = $fortune_label->Label(-textvariable => \$fortune)
-> pack(-side => 'top');
}
redmist