sub button($$$$$;$$$$) { my ($parent, $text, $pcmd, $x, $y, $fg, $bg, $width, $height) = @_; # Defaults $fg ||= 'white'; $bg ||= 'black'; $width ||= 1; $height ||= 1; # Color abbreviations my $p_abb = { 'db' => 'darkblue', 'dg' => 'darkgoldenrod', }; defined($p_abb->{$fg}) and $fg = $p_abb->{$fg}; defined($p_abb->{$bg}) and $bg = $p_abb->{$bg}; # Create the button widget (note command need not be given) my $b = $parent->Button(-text => $text); $pcmd and $b->configure(-command => $pcmd); $b->configure(-width => $width, -height => $height); $b->configure(-foreground => $fg, -background => $bg); # Place the button (no need to "pack" it first!), and return it $b->place(-x => $x, -y => $y); return $b; }