bh_perl has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm trying to study about Perl/Tk and I'm just installed Tk modules from www.cpan.org
This is my first Perl/Tk script....

#!/usr/bin/perl -w use Tk; my $version = "1.0"; my $main = MainWindow->new(); $main->minsize( qw(250 250)); $main->title("Billing Mediation Platform"); $main->configure(-background=>'cadet blue'); my $menu_bar = $main->Frame(-relief=>'groove', -borderwidth => 3, -background => 'dim grey', )->pack('-side'=>'top', -fill=>'x'); my $file_mb = $menu_bar->Menubutton(-text=>'File', -background => 'dim grey', -activebackground => 'light grey', -foreground => 'white', )->pack(-side => 'left'); $file_mb->command(label => 'Exit', # the problem was here -activebackground => 'magenta', -command => sub{ $main -> destroy} ); $file_mb->separator(); MainLoop();
And I have one error message here, which is :
No -label at /usr/lib/perl5/site_perl/5.6.1/i386-linux/Tk/Widget.pm line 247

Any body can guide me on that or might be I've download wrong modeule on that?

Replies are listed 'Best First'.
Re: I'm just learning Perl/Tk myself
by RMGir (Prior) on Aug 14, 2003 at 12:59 UTC
    I'm afraid the error message tells you exactly what's wrong.

    You have label => 'Exit', but you're missing the "-". It should be -label => 'Exit'.

    Hope this helps!

    (Edit: Removed "add MainLoop", since the code already has it. I must not have copied it...)
    --
    Mike

      Thank you very much...