in reply to Re^2: Grabbing Text widget's contents after MainLoop
in thread Grabbing Text widget's contents after MainLoop

My original solution was sort of over kill, this one is much better and simpler:

use Tk; use Tk::DialogBox; my $mw = new MainWindow(); my $content; my $text = $mw->Text()->pack(); my $ok = $mw->Button(-text => "OK", -command => \&grab)->pack(); MainLoop; print $content; sub grab { $content = $text->Contents(); $mw->destroy(); }

Replies are listed 'Best First'.
Re^4: Grabbing Text widget's contents after MainLoop
by GrandFather (Saint) on Jul 22, 2005 at 05:16 UTC

    Yep, that's pretty good! I had a hazy idea that something like that was required, but I don't know enough Tk yet to figure it out in reasonable time. I find the doucmentation for Tk a bit heavy going and diffuse at the same time.

    Thanks for a good solution.


    Perl is Huffman encoded by design.