in reply to Converting characters to keysyms
#!/usr/bin/perl use warnings; use strict; use Tk; #mouse must be positioned over "Exit" button for this to work. my $mw = MainWindow->new; $mw->bind( '<KeyPress>' => \&print_keysym ); $mw->Button( -text => 'Exit', -command => sub { exit(); } )->pack; MainLoop; sub print_keysym { my $widget = shift; my $e = $widget->XEvent; my ( $keysym_text, $keysym_decimal ) = ( $e->K, $e->N ); print "keysym=$keysym_text, numberic=$keysym_decimal\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Converting characters to keysyms
by naggiman (Novice) on Feb 18, 2005 at 16:17 UTC |