Hi Monks, I was reading the article Using advanced widgets in Perl/Tk, and following along with the exercices. The first example given is on using the NoteBook widget.

(code sligthly adapted with use strict and warnings)
#!/usr/bin/perl -w + use strict; use Tk; use Tk::NoteBook; + my $mw = MainWindow->new(); $mw->geometry( "400x100" ); my $book = $mw->NoteBook()->pack( -fill=>'both', -expand=>1 ); + my $tab1 = $book->add( "Sheet 1", -label=>"Start", -createcmd=>\&getSt +artTime ); my $tab2 = $book->add( "Sheet 2", -label=>"Continue", -raisecmd=>\&get +CurrentTime ); my $tab3 = $book->add( "Sheet 3", -label=>"End", -state=>'disabled' ); + my $starttime = ''; my $raisetime = ''; + $tab1->Label( -textvariable=>\$starttime )->pack( expand=>1 ); $tab2->Label( -textvariable=>\$raisetime )->pack( expand=>1 ); $tab3->Button( -text=>'Quit', -command=>sub{ exit; } )->pack( expand=> +1 ); + MainLoop; + sub getStartTime { $starttime = "Started at " . localtime; } sub getCurrentTime { $raisetime = " Last raised at " . localtime; $book->pageconfigure( "Sheet 3", -state=>'normal' ); }
When I execute this program, I get the error message:
bad option "expand": must be -after, -anchor, -before, -expand, -fill, + -in, -ipadx, -ipady, -padx, -pady, or -side at /usr/lib/perl5/site_p +erl/5.8.0/i386-linux-thread-multi/Tk/Widget.pm line 1144. at NoteBook.pl line 18
The relevant part in Widget.pm is:
# Two things going on here: # 1. Add configure on the front so that we can drop leading '-' $w->Tk::pack('configure',@_); # 2. Return the widget rather than nothing return $w;


I don't feel much like meddling in Widget.pm self, but what else should I do?

In reply to Bad option in Widget.pm by BioGeek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.