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
|
use Tk;
use Tk::Text;
$top = MainWindow->new();
my $main = $top -> Frame();
$main -> pack(-fill => 'both', -expand => 'yes');
my $rapport;
my $text = $main -> Scrolled
(
"Text",
-scrollbars => "osoe",
-exportselection => 'yes',
-relief => 'sunken',
-height => "12",
);
$text -> pack(-expand => 'yes', -fill=> 'both');
$top->bind( '<Any-KeyPress>' => sub
{
my($c) = @_;
my $e = $c->XEvent;
my( $x, $y, $W, $K, $A ) = ( $e->x, $e->y, $e->K, $e->W, $e->A );
#Pour connaitre la touche presser
#affichage des codes dans la console
print " x = $x\n";
print " y = $y\n";
print " K = $K\n";
print " W = $W\n";
print " A = $A\n";
#si la touche entrée écrire toto
if($W=~/Return/){$text->insert('end',"toto\n");}
} );
MainLoop();
__END__ |
Partager