ivo_ac has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use Tk; use strict; use warnings; require Tk::BrowseEntry; my $mw=MainWindow->new; my $f=$mw->Frame(-borderwidth=>2)->pack(-side=>'top', -fill=>'x'); my (@packwith) =(); my $numwidgets=4; for(my $i=0;$i<$numwidgets;$i++) { my $be = $f->BrowseEntry(-label => "Widget $i", -choices => ["left +", "right", "top", "bottom"], -variable => \$packwith[$i], -browsecmd => \&repack) - +> pack( -ipady=>20); } my $b=$f->Button(-text =>"repack", -command=> \&repack)->pack(-side => + "bottom"); my $tl=$mw->Toplevel(-title=>"output"); for (my $i=0;$i<$numwidgets;$i++) { my $b=$tl->Button(-text=> "Button $i")->pack(-side => $packwith[$i +]); } MainLoop; sub repack { my @slaves = $tl->packSlaves; my $j=0; foreach (@slaves) { $_->packForget; $_->pack(-text => "Button ".$j, -side=>\$packwith[$j++]); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strange Perl/Tk error
by lamprecht (Friar) on Mar 27, 2010 at 12:59 UTC | |
by ivo_ac (Acolyte) on Mar 27, 2010 at 13:37 UTC | |
by ivo_ac (Acolyte) on Mar 27, 2010 at 13:51 UTC | |
by Anonymous Monk on Apr 25, 2012 at 12:37 UTC | |
by Anonymous Monk on Apr 26, 2012 at 02:10 UTC | |
by Anonymous Monk on Apr 25, 2012 at 13:40 UTC | |
|
Re: Strange Perl/Tk error
by moritz (Cardinal) on Mar 27, 2010 at 09:30 UTC | |
by ivo_ac (Acolyte) on Mar 27, 2010 at 10:07 UTC | |
|
Re: Strange Perl/Tk error
by Khen1950fx (Canon) on Mar 27, 2010 at 11:03 UTC | |
|
Re: Strange Perl/Tk error
by Khen1950fx (Canon) on Mar 27, 2010 at 10:27 UTC | |
by ivo_ac (Acolyte) on Mar 27, 2010 at 10:42 UTC | |
by ivo_ac (Acolyte) on Mar 27, 2010 at 10:36 UTC |