Hi!

First of all: for the second MainWindow use grid instead of pack, so you don't need all those frames.
I wrote a small script, where you can see how I would do what you want (I hope it is what you want :-)):

use Tk; my $top = new MainWindow(); my %density = ( DI => "1", HF => "1.16", NH4OH => "0.9", H202 => "1.11", HCl => "1.18", H2SO4 => "1.84", Citric => "1", NH4F => "1.01", TMAH => "1", Nitric => "1.415", Acetic => "1.05", Phosphoric => "1.7", IPA => "0.79" ); my $i = 0; for my $x (keys %density) { $top->Radiobutton( -value=>$i, -command=>[\&colorme, $i])->grid(-row=>$i,-column=>0); $top->Label(-text=>$x)->grid(-row=>$i,-column=>1); $entry[$i] = $top->Entry(-bg=>'white')->grid(-row=>$i,-column=>2); $entry[$i]->insert('end',$density{$x}); $i++; } MainLoop(); sub colorme { my $i = shift; map{$_->configure(-bg=>'white')}@entry; $entry[$i]->configure(-bg=>'black'); }
Hope this helps.
mawe

In reply to Re: Binding Events In Perl TK by mawe
in thread Binding Events In Perl TK by ~~David~~

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.