in reply to Tk bind key hexadecimal value
Perhaps something like this using a virtual event:
#!/usr/bin/env perl use strict; use warnings; use Tk; my $mw = MainWindow::->new(); $mw->eventGenerate('<<FakeF1>>'); $mw->eventAdd('<<FakeF1>>' => '<F2>'); $mw->bind('<F1>' => [\&f1_callback, Ev('%k')]); $mw->bind('<<FakeF1>>' => [\&f1_callback, Ev('%k')]); MainLoop; sub f1_callback { printf "F1 callback generated with %#x\n", $_[1]; }
When I run this and press F1 followed by F2, I get this output:
F1 callback generated with 0x43 F1 callback generated with 0x44
Those methods are documented in Tk::event and Tk::bind.
— Ken
|
|---|