in reply to Re: Dynamically destroying a window in Tk?
in thread Dynamically destroying a window in Tk?

Yep, A reference allows you to pass the actual variable (contents and all, which is what you need) With the single quotes, you're basically passing an indirect reference (though not quite in the way that more or less works) and that's generally considered a Bad Thing. Try passing a real refernce as I mentioned in my last post, and let us know how/if that works.

I believe the sub will need altered a touch to, this should do it:

sub quit { $$_[0]->destroy; }
Just Another Perl Alchemist

Replies are listed 'Best First'.
Re^3: Dynamically destroying a window in Tk?
by Spidy (Chaplain) on Dec 06, 2004 at 23:15 UTC
    Alright, I've messed around with it a bit, and managed to get it down to this:
    MainWindow=HASH(0x164a81c) is not a widget at *.pl line **.


    Any more ideas?
      What is $windowname? Where does it come from/get created? Can you show the code that creates it? Also the result of ref($windowname) which should tell us what it is (widget or no).

      I suspect it's getting unblessed somewheres..

      C.

        Well, here's the code...
        my $ftpinfo=MainWindow->new; my $ftpinfomenu = $ftpinfo->Menubutton(-text=>"File",-underline=>1,-me +nuitems=>[ [button=>"Clear",-command=>\&clearentries], [button=>"Save Entry",-command=>\&saveentries], [button=>"Load Entry",-command=>\&loadentry], [button=>"Close Window",-command=>sub{$ftpinfo->destroy}], ]) -pack(-side=>"right");

        However, now it's giving me an error about '-label' being a bad window path name in the Tk modules?