#!/usr/local/bin/perl -w use 5.005; use Tk; use Tk::widgets qw/Dialog/; use subs qw/build_menubar fini/; use vars qw/$MW $VERSION/; use strict; $MW = MainWindow->new; my $menubar = build_menubar; my $Body = $MW->Frame(qw/-width 640 -height 100 -background cyan/)->pack; MainLoop; sub build_menubar { my $menubar = $MW->Menu; $MW->configure(-menu => $menubar); my $file = $menubar->cascade(-label => '~File'); $file->command(-label => "Print Text", -command => \&PrintText); $file->command(-label => "Quit", -command => \&fini); $menubar; } sub PrintText{ my $lbl = $Body->Label(-text => "This is new text", -background => 'red', -width => '100', -height => '100' )->pack(-side => 'top'); } sub fini { exit; }