in reply to Tk::pack help

#!/usr/bin/perl -w use strict; use Tk; my $mw = MainWindow->new; my $top_frame = $mw->Frame()->pack(-side => "top"); my $bot_frame = $mw->Frame()->pack(-side => "top"); $top_frame->Button(-text => "A",)->pack(-side => "left"); $top_frame->Button(-text => "B",)->pack(-side => "left"); $bot_frame->Button(-text => "C",)->pack(-side => "left"); $bot_frame->Button(-text => "D",)->pack(-side => "left"); MainLoop;


-- All code is 100% tested and functional unless otherwise noted.

Replies are listed 'Best First'.
Re^2: Tk::pack help
by sleepingsquirrel (Chaplain) on Aug 03, 2004 at 20:36 UTC
    Maybe closer to your needs...
    #!/usr/bin/perl -w use strict; use Tk; my $mw = MainWindow->new; for (["A","B"],["C","D"],["E","F"],["G","H"]) { my $frame = $mw->Frame()->pack(-side => "top"); $frame->Button(-text => "$_->[0]",)->pack(-side => "left"); $frame->Button(-text => "$_->[1]",)->pack(-side => "left"); } MainLoop;


    -- All code is 100% tested and functional unless otherwise noted.