jsteng has asked for the wisdom of the Perl Monks concerning the following question:
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 norma +l', -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", '<Double-1>' => sub { markAccount($i +) } ); } } InitializeListBox(); MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to extract, delete TK tags' option/value
by tybalt89 (Monsignor) on Apr 20, 2018 at 14:22 UTC | |
|
Re: How to extract, delete TK tags' option/value (as documented)
by Anonymous Monk on Apr 20, 2018 at 06:36 UTC | |
|
Re: How to extract, delete TK tags' option/value (Tk ROText indices index tagAdd tagRemove)
by Anonymous Monk on Apr 20, 2018 at 19:37 UTC |