use Tk; my $top = new MainWindow; my $t = $top->Text()->pack(); my $b = $top->Button(-text=>"OK",-command=>\&get_it)->pack(); MainLoop; sub get_it { my $text = $t->get(0.1,"end"); print "$text\n"; }