#!/usr/bin/perl -w use warnings; use strict; use Tk; use Tk::TableMatrix; my $mw = MainWindow->new; my $data = {}; my $t = $mw->Scrolled('TableMatrix', -variable => $data)->pack; $t->focus; $mw->bind('Tk::TableMatrix', '', \&test_busy); #global counter our $i; sub test_busy { my $w = shift; #give time to generate multiple events via keyboard # before Busy statement is reached. for my $k (0..2000000) { #whatever my $l = $k; } #store current value of counter #right before entering Busy statement my $j = ++$i; $w->Busy(-recurse => 1); print "$j\n"; $w->Unbusy; } MainLoop;