#!/usr/bin/perl #------------------------------------------------------------------------------ # Pakete / Pragmas: #------------------------------------------------------------------------------ use strict; use warnings; use Tk; #------------------------------------------------------------------------------ # Mainwindow: #------------------------------------------------------------------------------ my $mw = new MainWindow; #------------------------------------------------------------------------------ # Buttonanordnung: #------------------------------------------------------------------------------ my @textarray = ( [qw/1 2 3/], [qw/4 5 6/], [qw/7 8 9/], [qw/0/] ); #------------------------------------------------------------------------------ # Frames: #------------------------------------------------------------------------------ my $f = $mw->Frame( )->pack( -fill => 'both', -expand => 1, -side => 'top', ); my @frames; for (1 .. @textarray) { my $fx = $f->Frame( )->pack( -fill => 'both', -expand => 1, -side => 'top', ); push @frames, $fx; } #------------------------------------------------------------------------------ # Buttons: #------------------------------------------------------------------------------ my $frame_index = 0; for my $texte (@textarray) { for my $text (@$texte) { my $b = $frames[$frame_index]->Button( -text => "$text", -command => sub { print "Button '$text' wurde gedrueckt.\n" }, ) ->pack( -fill => 'x', -ipadx => 5, -side => 'left', -fill => 'both', -expand => 1, ); } ++$frame_index; } MainLoop();