#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new; my $rb = 'first button'; my $rb1 = $mw->Radiobutton(-text => "Button One", -value => 'button1', -variable => \$rb)->pack; my $rb2 = $mw->Radiobutton(-text => "Button Two", -value => 'button2', -variable => \$rb)->pack; my $b1 = $mw->Button(-text => 'Show', -command => [ \&showRB, \$rb ])->pack; MainLoop; sub showRB { print "Arg list is @_ \n"; my $state_ref = shift; my $state = $$state_ref; print "$state\n"; $mw->messageBox(-title => 'Status', -type => 'OK', -message => "Status is :$state:."); } #### #!/usr/bin/perl use warnings; use strict; use Tk; my $top = MainWindow->new; $top->geometry('200x200+100+100'); # Menubar my $menu = $top->Frame(-relief => 'raised', -bd => 2); my $menu_pulldown = $menu->Menubutton(-text => "Test", -underline => 0); $menu_pulldown->command(-label => "Exit", -command => sub { exit 0 }); # Cascade Menu $menu_pulldown->cascade(-label => "Cascade", -underline => 1,); my $newmenu = $menu_pulldown->cget(-menu)->Menu; $menu_pulldown->entryconfigure('last', -menu => $newmenu); $newmenu->command(-label => "CascadeCommand", -command => sub { exit 0 }); $menu->pack(-side => 'top', -fill => 'x'); $menu_pulldown->pack(-side, 'left'); MainLoop;