Canvas key bindings not working as expected
"Rainer J.H. Brandt" <[email protected]> Sun, 13 Mar 2011 20:55:20 +0100
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
Hello folks,
I'm trying to define bindings to a canvas as a whole.
That works for mouse buttons, but not for keyboard events.
I tried this:
use Tk;
$m =3D MainWindow->new();
$c =3D $m->Canvas()->pack();
$c->Tk::bind('<1>' =3D> sub { print "button1\n" });
$c->Tk::bind('<KeyPress-a>' =3D> sub { print "key a\n" });
$c->CanvasBind('<2>' =3D> sub { print "button2\n" });
$c->CanvasBind('<KeyPress-b>' =3D> sub { print "key b\n" });
MainLoop;
Both button bindings work, but neither of the key bindings do.
This is with Perl 5.12.2 and Perl/Tk 804.029 under Solaris 10
and Mac OS X Snow Leopard.
Am I overlooking something?
Thanks,
Rainer
-- =
Rainer J. H. Brandt
Brandt & Brandt Computer GmbH
Am Wiesenpfad 6, 53340 Meckenheim
Gesch=E4ftsf=FChrer: Rainer J. H. Brandt und Volker A. Brandt
Handelsregister: Amtsgericht Bonn, HRB 10513
RFC 5322: "Each line [...] SHOULD be no more than 78 characters"
--++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--+=
+**=3D=3D
ptk mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/ptk