I can't seem to bind key press events to the canvas widget.I used the wish shell for the simplest possible test and wrote the following code from the console.
(bin) 2 % canvas .can -bg black
.can
(bin) 3 % pack .can
(bin) 4 % bind .can <Button-1> {tk_messageBox -message "%W got button press"}
(bin) 5 % bind .can <KeyPress> {tk_messageBox -message "%W got key press"}
When I click the mouse button inside the canvas I get the message expected but when I press a key inside the canvas nothing happens. Anyone else have this problem?
(bin) 2 % canvas .can -bg black
.can
(bin) 3 % pack .can
(bin) 4 % bind .can <Button-1> {tk_messageBox -message "%W got button press"}
(bin) 5 % bind .can <KeyPress> {tk_messageBox -message "%W got key press"}
When I click the mouse button inside the canvas I get the message expected but when I press a key inside the canvas nothing happens. Anyone else have this problem?