Re: example from Mastering Perl/Tk (correction)
by Tim Harsch other posts by this author
May 8 2003 8:19PM messages near this date
Re: example from Mastering Perl/Tk
|
Re: example from Mastering Perl/Tk (correction)
Hi Michael,
Thanks much, that helps a bunch.
I think I've learned that actually, both "Toplevel" and "toplevel"
worked, but with differing effects. I think "Toplevel" is the one we want.
I think "toplevel" is a function of Tk:MainWindow(?) that returns the widget
handle of the inherent Toplevel of the MainWinow. Whereas "Toplevel"
creates a new Toplevel widget (which had the effect of opening a new window
with the Close button in it.). The "toplevel" had the effect of shoving the
Close button just underneath the TopLevel button and changing the title of
the current window. Which makes me think it returns the inherent Toplevel
refence of the MainWindow.
This whole MainWindow, frame, TopLevel thing confuses me. I'm still not
solid on what the real differences between them are...
----- Original Message -----
From: "Michael van Nieuwenhuize" <michaelv@[...].com>
To: "Tim Harsch" <harsch1@[...].gov> ; "PTK" <ptk@[...].EDU>
Sent: Thursday, May 08, 2003 11:16 AM
Subject: Re: example from Mastering Perl/Tk (correction)
> Tim,
>
> I sent you the wrong info.
>
> Try this instead:
>
> $tl = $mw->Toplevel()
>
> Mike
>
>
> 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@[...].edu
>
> Michael van Nieuwenhuize
>
> Phone: (858) 651-7413
> Pager: (858) 636-9438 or
> michaelv@[...].com
> email : michaelv@[...].com
> Office: BB-122E
>
> -++**==--++**==--++**==--++**==--++**==--++**==--++**==
> 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@[...].edu
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
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
|