- Menubutton
Perl Tk Menu Button
I am not sure when would you want to build a menu this way. I only have this example as this is the first one I managed to create and did not want to throw it away.
examples/tk/menu_button.pl
use strict; use warnings; use 5.010; use Tk; my $top = MainWindow->new; my $main_menu = $top->Menubutton(-text => "File" ); my $file_menu = $main_menu->Menu( -menuitems => [ [Button => 'Hello', -command => sub { say 'Hello' } ], [Button => 'Quit', -command => sub { exit } ], ] ); $main_menu->configure(-menu => $file_menu); $main_menu->pack(); MainLoop;