Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Problem following Tk demo in Advanced Perl Programming

by elbie (Deacon)
on Aug 29, 2001 at 23:03 UTC ( #108853=perlquestion: print w/ replies, xml ) Need Help??
elbie has asked for the wisdom of the Perl Monks concerning the following question:

I feel really stupid asking this. My apologies in advance.

I'm working through the Perl/Tk chapters in O'Reilly's Advanced Perl Programming. I typed in the menu example verbatum minus comments and with only one button (included below) and I get this error:

No -label at /usr/lib/perl5/site_perl/5.005/i586-linux/Tk/Widget.pm line 247

The perldocs for Tk::Menubutton, Tk::options, Tk::Menu, and Tk::Widget don't make any reference to a label option in any way that I can find meaningful.

Is there some other distro of Perl/Tk that I should be using? How can I tell?

elbieelbieelbie

use Tk; $top = MainWindow->new(); $menu_bar = $top->Frame()->pack(side => 'top'); $search_mb = $menu_bar->Menubutton(text => 'Search', relief => 'raised', borderwidth => 2 )->pack(side => 'left', padx => 2 ); $search_mb->command(label => 'Find', accelerator => 'Meta+F', underline => 0, command => sub {print "find\n"} ); MainLoop();

Comment on Problem following Tk demo in Advanced Perl Programming
Download Code
(jeffa) Re: Problem following Tk demo in Advanced Perl Programming
by jeffa (Chancellor) on Aug 30, 2001 at 00:00 UTC
    change label to -lable

    :)

    Another reference (sic) to check out is Learning Perl Tk.

    Big whoops! - thanks Graham! yes, -label

    jefaf

      Surely that should read "-label" So that the entire script is
      use Tk; $top = MainWindow->new(); $menu_bar = $top->Frame()->pack(side => 'top'); $search_mb = $menu_bar->Menubutton(text => 'Search', relief => 'raised', borderwidth => 2 )->pack(side => 'left', padx => 2 ); $search_mb->command(-label => 'Find', accelerator => 'Meta+F', underline => 0, command => sub {print "find\n"} ); MainLoop();

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://108853]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-09-15 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (145 votes), past polls