use Tk; my $mw = new Tk::MainWindow; my $c = $mw->Canvas(-width => 300, -height => 100)->pack; my $text = $c->createText(20, 20, -text => 'A text item'); my $but = $c->Button(-text => 'Push me!', -command => sub { colour_text('red'); $mw->after(500, [\&colour_text => 'black']); }, ); my $but_i = $c->createWindow(70, 50, -window => $but); MainLoop; sub colour_text { my $colour = shift; $c->itemconfigure($text, -fill => $colour); }