| 1 |
#!/usr/local/bin/perl -w |
| 2 |
use strict; |
| 3 |
use Tk; |
| 4 |
use Tk::Font; |
| 5 |
|
| 6 |
my $mw = MainWindow->new; |
| 7 |
my $font = $mw->Font(family => 'courier', point => 140, weight => 'bold', slant => 'r'); |
| 8 |
my $lb = $mw->Scrolled('Listbox', -font => $font)->pack(-expand => 1, -fill => 'both');; |
| 9 |
$mw->Button(-text => 'Quit', -command => [destroy => $mw])->pack; |
| 10 |
|
| 11 |
opendir(DIR,".") || die "Cannot opendir '.':$!"; |
| 12 |
foreach (sort readdir(DIR)) |
| 13 |
{ |
| 14 |
my $size = (stat($_))[7]; |
| 15 |
$lb->insert('end',sprintf("%6d $_",$size)); |
| 16 |
} |
| 17 |
|
| 18 |
MainLoop; |
| 19 |
|