- TkのMenubuttonおよびFrameウィジェットを使用する。
use Tk;
$main = MainWindow->new();
$menubar = $main
->Frame(-relief => "raised", -borderwidth => 2)
->pack(-anchor => "nw", -fill => "x");
$file_menu = $menubar
->Menubutton(-text => "File", -underline => 1)
->pack(-side => "left");
$file_menu->command(-label => "Print", -command => \&Print);
$file_menu = $menubar
->Menubtutton(
-text => "File",
-underline => 1,
-menuitems => [
[ Button => "Print", -command => \&Print ],
[ Button => "Save", -command => \&Save ] ])
->pack(-side => "left");