Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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();

Replies are listed 'Best First'.
(jeffa) Re: Problem following Tk demo in Advanced Perl Programming
by jeffa (Bishop) 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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2016-12-09 17:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (153 votes). Check out past polls.