in reply to Tk Text widget & key bindings
Your text widget needs focus to receive key events. Configure -takefocus => 1 or give it focus calling $text->focus().
Cheers, Christophuse warnings; use strict; use Tk; my $t=tkinit->Text(-state => 'disabled', -takefocus =>1, # tab-key moves focus )->pack; $t->bind('<Any-Key>'=>sub { print "received Key\n"; }); $t->focus; #init focus MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tk Text widget & key bindings
by brian42miller (Sexton) on Apr 21, 2011 at 19:09 UTC |