Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Perl Tk Any Key binding

use strict;
use warnings;
use 5.010;

use Tk;

my $top = MainWindow->new;

my $label = $top->Label(
    -text => 'Press any key',
    -font => ['fixed', 40],
    -background => 'yellow',
);
$label->pack();

sub key_pressed {
    my $window = shift;
    my $event = $window->XEvent;
    #say $event;
    say $event->K;
}

$top->bind("<Any-KeyPress>", \&key_pressed);


MainLoop;