This form of array initialization can probably be improved upon -- maybe you would prefer a hash of arrays, the hash keyed by field name and each array being the label string, DB field name, textvariable scalar, and widget handle. But any sort of hash array setup will be more compact and easier to maintain/adapt that a set of discrete scalars.my %field; my @names = (qw/serial phone email po address city state zip etc/); my @sizes = ( 30, 30, 30, 30, 75, 30, 30, 30, 80 ); my @labls = ("Serial Number:", "Phone Number:", "and so on..."); foreach (@names) { $field{$_}{txvar} = ''; $field{$_}{label} = $rf->Label(-text => shift( @labls )); $field{$_}{entry} = $rf->Entry(-width => shift( @sizes ), -textvariable => \${$field{$_}{txvar +}}, ); }
(Also, note that you don't really need to keep track of the handles for those label widgets, unless you plan to recongifure them along with the Entry widgets as part of the GUI's behavior.)
In reply to Re: Tk Field Changes
by graff
in thread Tk Field Changes
by £okì
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |