#!./perl
BEGIN { push(@INC, qw(../../../lib ../../lib ../lib lib)) }
use Tk;

$top = tkinit;

$l = Label::new($top, "-text" => "Hello world");

# A callback can be an anonymous sub
tkbind($l, "<1>", sub { print "Hello world\n" });

# And you can get at event fields from the callback with magic "Ev" variables
tkbind($l, "<Any-KeyPress>", sub { print "You hit key $Tk::EvK\n" });

# For keypresses, Tk itself requires that you set the focus though.
focus $l;

tkpack $l;
tkmainloop;
