Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Binding Events In Perl TK

by mawe (Hermit)
on Aug 27, 2004 at 13:54 UTC ( [id://386371]=note: print w/replies, xml ) Need Help??


in reply to Binding Events In Perl TK

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://386371]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-16 21:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found