This is a discussion on Re: malfunctioning keys in sun 10-key under Perl/Tk - Perl ; Hi! I have a question about a code snippet I found in the Mastering Perl/Tk book (chapter 15). I just wrapped it with a couple lines of code: ========== #!/usr/local/perl585/bin/perl -w use Tk; my $title = $ARGV[0] || $0; my ...
Hi!
I have a question about a code snippet I
found in the Mastering Perl/Tk book (chapter
15). I just wrapped it with a couple lines of
code:
==========
#!/usr/local/perl585/bin/perl -w
use Tk;
my $title = $ARGV[0] || $0;
my $mw = new MainWindow;
$mw->title($title);
$mw->bind('KeyPress' => \&print_keysym);
my $label = $mw->Label(-text => $title);
$label->pack;
my $entry = $mw->Entry(-width => 20);
$entry->pack;
my $button = $mw->Button(-text => "Exit", -command => sub { exit; });
$button->pack;
MainLoop;
sub print_keysym {
my ($widget) = @_;
my $e = $widget->XEvent;
my($keysym_text, $keysym_decimal) = ($e->K, $e->N);
print "keysym=${keysym_text}, numeric=${keysym_decimal}\n";
}
==========
The problem is that it doesn't seem to
print anything at all. I made another
program to dump the bindings and
nothing seems to get bound either.
I think I must be doing something
wrong, I just don't know what. Will someone
please give me a clue? Thanks in advance,
sorry to bother you all.
Troy Johnson
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu