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"; }

I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: Converting characters to keysyms
by naggiman (Novice) on Feb 18, 2005 at 16:17 UTC
    This will allow me to get the codes interactively, and so remove some of the hassle, but I may still miss some keys. I would like to grab the whole lot all in one go on the fly rather than labouriously hard-code.