rewrite to include complete app
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;



How do I reliably fetch a tag's "option" whether that option exists or not?


Secondly, How do I delete a particular option/value within tag?
ie, remove a single option: remove -font,
ie, remove all options: remove -font ..... foreground...




Thirdly, Does it even matter if I delete unused options or not? Will having unused option slows down the script?


thanks

In reply to How to extract, delete TK tags' option/value by jsteng

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.