use Tk; use strict; my $mw = MainWindow->new; my $popup = $mw->Menu(-tearoff => 0); $popup->command(-label => 'Test print', -command => sub { print "test\n"; $popup->Unpost; }); $mw->bind('', sub { $popup->Popup(-popover => 'cursor', -popanchor => 'sw'); }); MainLoop;