1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #!/usr/bin/perl
use warnings;
use strict;
use utf8;
use Tk;
my $main = MainWindow->new(
-background => '#BDC5EE',
-title => 'exemple Commande shell',
);
my $WidgetResult = $main->Scrolled('Text',
-scrollbars => 'osoe',
)->pack( qw/ -fill both -expand 1 / );
for my $commande ( 'dir', 'DATE /T', 'VER') {
$main->Button(
-text => "Commande $commande",
-command => sub {
my $result = `$commande`;
$WidgetResult->delete('1.0', 'end');
$WidgetResult->insert('end', $result);
},
)->pack;
}
MainLoop; |
Partager