use strict; use warnings; use Tk; my %w; $w{mw} = MainWindow->new; for (qw/ this that a_longer_name X /){ my $bttn = $w{mw}->Button( -text => "$_ ", -font => 'times 19', -justify => 'right', -compound => 'right', -bitmap => 'warning', #-image => $w{mw}->Photo( -file => 'whatever' ), -anchor => 'e', -padx => 4, )->pack; push @{$w{buttons}}, $bttn; } $w{mw}->update; { my $width = 0; for (@{$w{buttons}}) { $width = $_->width if $_->width > $width; } for (@{$w{buttons}}) { $_->configure( -width => $width ); } } MainLoop;