use Tk; use Tk::Text; $mw = MainWindow->new; $edit = $mw->TextUndo->pack; $edit->insert('end', 't'); $edit->tagConfigure('', -font => $mw->Font(-family => 'times', -weight => 'bold')); $edit->tagConfigure('elide', -elide => 1); $tag = ""; $mw->Button(-text => 'bold', -command => sub { $edit->insert('insert', 'de', [$tag, 'elide']); $edit->tagAdd($tag, 'insert'); })->pack; MainLoop;