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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| #!/usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::LabFrame;
use Tk::LabEntry;
use Tk::BrowseEntry;
my $mw = MainWindow->new(
-title => "bm",
-background => 'white',
);
$mw->minsize( 500, 500 );
my $frame = $mw->Frame()->pack(qw/ -pady 10 -padx 10 /);
my ( $argument1, $argument2 );
my $BrowseEntry1 = $frame->BrowseEntry(
-label => "name : ",
-variable => \$argument1,
-choices => [ "BMW-M", "BMW-S" ],
)->pack(qw/ -side left -padx 10 /);
my $BrowseEntry2 = $frame->BrowseEntry(
-label => "n : ",
-variable => \$argument2,
-choices => [ "1", "2" ],
)->pack(qw/ -side right -padx 10 /);
$mw->Button(
-text => "lancer prog",
-command => [ \&voiture, \$argument1, \$argument2 ],
)->pack();
MainLoop;
sub voiture {
my ( $Refargument1, $Refargument2 ) = @_;
my ( $argument1, $argument2 ) = ( ${$Refargument1}, ${$Refargument2} );
print "Argument 1 : : $argument1\n" if ( defined $argument1 );
print "Argument 2 : : $argument2\n" if ( defined $argument2 );
# Les 2 arguments sont définis
if ( defined $argument1 and defined $argument2 ) {
system("voiture_v8.exe $argument1 $argument2");
}
else {
warn "Les 2 arguments ne sont pas ok\n";
}
return;
} |
Partager