Re: example from Mastering Perl/Tk
by Marc Dashevsky other posts by this author
May 8 2003 6:51PM messages near this date
RE: example from Mastering Perl/Tk (correction)
|
Re: example from Mastering Perl/Tk
At 01:26 PM 5/8/2003, Michael van Nieuwenhuize wrote:
> Try changing
>
> $tl = $mw->TopLevel();
>
> to
>
> $tl = $mw->toplevel();
>
> This seemed to work on my machine.
I'm very surprised to hear this. Toplevel requires an upper-case 'T'.
> At 09:45 AM 5/8/2003 -0700, Tim Harsch wrote:
> >Hi all,
> >
> >I typed in this example, as far as I can tell, exactly as it appears in the
> >CH11, p.233 of the book.
> >
> >use Tk;
> >
> >$mw = MainWindow->new();
> >$mw->title("MainWindow");
> >$mw->Button( -text => "TopLevel", -command => \&do_TopLevel )->pack();
> >
> >MainLoop;
> >sub do_TopLevel {
> > if( ! Exists($tl) ) {
> > $tl = $mw->TopLevel();
> > $tl->title("TopLevel");
> > $tl->Button( -text => "Close",
> > -command => sub { $tl->withdraw })->pack();
> > } else {
> > $tl->deiconify();
> > $tl->raise();
> > } # end if
> >} # end sub
> >
> >
> >I get errors I don't understand when I try to run it:
> >Tk::Error: Can't locate auto/Tk/TopLevel.al in @INC (@INC contains:
> >C:\Program Files\ActiveState Komodo 2.3 C:/Perl/lib C:/Perl/site/lib .) at
> >C:\Documents and Settings\Tim Harsch.BBRP2000\My Documents\Book
> >Code\mastperltk_examples\mptk-code14\ch11\TopLevel.pl line 11
> > Carp::croak at C:/Perl/lib/Carp.pm line 119
> > AutoLoader::AUTOLOAD at C:/Perl/lib/AutoLoader.pm line 104
> > main::do_TopLevel at C:\Documents and Settings\Tim Harsch.BBRP2000\My
> >Documents\Book Code\mastperltk_examples\mptk-code14\ch11\TopLevel.pl line 11
> > [\&main::do_TopLevel]
> > Tk callback for .button
> > Tk::__ANON__[C:/Perl/site/lib/Tk.pm:228] at C:/Perl/site/lib/Tk.pm line 228
> > Tk::Button::butUp at C:/Perl/site/lib/Tk/Button.pm line 113
> > (command bound to event)
> >
> >
> >Help.
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
Thread:
Marc Dashevsky
Michael van Nieuwenhuize
|