boblikeperl has asked for the wisdom of the Perl Monks concerning the following question:
#!D:\ActivePerl\bin\perl.exe -w require 'd:\\perlscripts\\A34980A.pm'; use English; use Tk; my $arg = ""; my $cmd = ""; my $main_menu = ""; my $menu_btn = ""; my $mtxsp = ""; my $mw = ""; my %cmd_list = ("A34980 Switch Cycles","\&get_SwCycles", "A34980 Info","\&getA34980Info"); # Setup GUI interface $mw = MainWindow->new; $mw -> minsize(qw(600 600)); $mw -> title(" Test TK"); # Create Frame to manage buttons $main_menu = $mw->Frame(-relief => "groove", -borderwidth => 3, -background => "light blue") -> pack(-side => + 'top', -fill = +> 'x'); # Create FILE menu button on top level $menu_btn = $main_menu -> Menubutton(-text => "Apps", -background => "light blue", -activebackground => "cyan", -foreground => "black") -> pack(-side = +> "left"); # Create List of sub menus from Apps menu button foreach $arg (keys %cmd_list) { $cmd = $cmd_list{$arg}; $menu_btn->command(-label => $arg, -background => "white", -activebackground => "cyan", -foreground => "black", -command => [$cmd], ); $menu_btn->separator(); } # Add an Exit to the menu list $menu_btn->command(-label => "Exit", -background => "white", -activebackground => "cyan", -foreground => "black", -command => sub { exit }, ); $menu_btn->separator(); MainLoop;
Tk::Error: Undefined subroutine &main::&getA34980Info called at D:/Act +ivePerl/site/lib/Tk.pm line 411
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: PERL/Tk and Menu -command option
by GrandFather (Saint) on Oct 18, 2005 at 19:49 UTC |