rocklee has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
Can you (zantara;) explain to me why the below code does not work?
use Tk; my $mw = new MainWindow; $mw->bind('all' => '<Key-Escape>' => sub {exit;}); # If below line is commented out, program works. $mw->FullScreen(1); MainLoop;
I expect this program to exit when the escape key is pressed, but it does not. No key bindings work in this manner, but if I change it to a mouse binding, say <1> it works.
However if I do this with a window that is not MainWindow, like so:
use Tk; my $mw = new MainWindow; my $tl = $mw->Toplevel; $tl->bind('all' => '<Key-Escape>' => sub {exit;}); $tl->FullScreen(1); MainLoop;
it works! .. What gives? Obviously I can work around this, but is it possible to have the key bindings with MW in fullscreen?.. cheers!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk fullscreen mainwindow key bindings
by zentara (Cardinal) on Nov 02, 2008 at 14:30 UTC | |
by rocklee (Beadle) on Nov 02, 2008 at 17:48 UTC |