in reply to Binding Events In Perl TK
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 :-)):
Hope this helps.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'); }
|
|---|