#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::ExecuteCommand; my $top = MainWindow->new; my $menu = $top->Menu( -type => 'menubar' ); $top->configure( -menu => $menu ); $menu->Cascade( -label => '~Selections', -tearoff => 1, -menuitems => [ [ Button => 'dir', -command => [ \&printchoice, 'dir' ] ], [ Button => 'time', -command => [ \&printchoice, 'time' ] ], [ Button => 'ls', -command => [ \&printchoice, 'ls' ] ], ], ); my $ec = $top->ExecuteCommand( -command => '', -entryWidth => 50, -height => 10, -label => '', -text => 'Execute', )->pack; MainLoop; sub printchoice { my $choice = shift; print $choice, "\n"; $ec->configure( -command => $choice ); $ec->execute_command; $ec->bell; $ec->update; }