in reply to Perl/Tk: Is there a way to key off of any user input event?
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new; #my $width = $mw->screenwidth; #my $height = $mw->screenheight; #$mw->geometry($width . 'x' . $height .'+0+0'); $mw->bind('<Motion>', [\&activity ,'mouse']); $mw->bind('<Key>', [ \&activity, Ev('K')]); $mw->after(500,sub {$mw->grabGlobal}); #window must be visible $mw->focusForce; #for grab MainLoop; sub activity { if( $_[1] eq 'Escape'){ exit } print chr(07); #beep }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl/Tk: Is there a way to key off of any user input event?
by Argel (Prior) on Oct 17, 2006 at 01:07 UTC |