use strict; use warnings; use Tk; my $mw = MainWindow->new( -bg=> "#000000", -borderwidth=> 0); $mw->geometry( '1000x600' ); my $LB = $mw->Scrolled ( 'ROText', -bg => '#C0C0C0', -fg => '#000000', -selectforeground => '#000000', -selectbackground => '#C0C0C0', -font => 'courier 18 normal', -relief => 'groove', -cursor => 'top_left_arrow', -scrollbars => 'e', -insertwidth => 0, -spacing1 => 1, -spacing2 => 1, -wrap => 'none', )->pack( -side => 'right', -expand => 1, -fill => 'both', ); sub markAccount { my $this = shift; my $f = $LB->tagCget("A$this", -font); printf "Mark: %d,%s\n",$this, $f; if (${$f} =~ /normal/i) { $LB->tag('configure', "A$this", -font => 'courier 18 normal', -foreground => '#000000', ); } else { $LB->tag('configure', "A$this", -font => 'courier 18 bold', -foreground => '#0000FF', ); } } sub InitializeListBox { $LB->delete('1.0','end'); for my $i (1..200) { $LB->insert('end', sprintf("%s\n",$i), "A$i" ); $LB->tag( 'bind', "A$i", '' => sub { markAccount($i) } ); } } InitializeListBox(); MainLoop;