#set up main window display use Tk; $mw = new MainWindow(-title => 'PopUp'); @buttons = qw(A B C D E F G); #popup menu set up $popupmenu = $mw->Menu(-tearoff => 0); for (my $ctr = 0; $ctr <@buttons; $ctr++){ $popupmenu->insert(1, 'command', -label => $buttons[$ctr], -command => [sub {print $popupmenu->cget('text') ."\n"}], ); } $mw->bind("" => sub {$popupmenu->Popup(-popover => "cursor", -popanchor => 'nw') -command => [sub {print "Popup\n"}]}); MainLoop();