I am trying to create a Perl program (Perl Tk GUI) that runs different scripts based on what users choose out of a menu at the top. The scripts output text progress and feedback based on records that the script processed into a Scrolled widget/element. I want to be able to forget/destroy/delete the widget when I move to a new option in the menu so I can create a fresh one to output text from the next script the user will run.
my $mainFrame = $mw->Frame()->pack(-side=>'top'); my $tx = $mainFrame->Scrolled(qw/Text -font normal -width 73 -height 15 -wrap word -scrollbars e/); $tx->pack; tie *STDOUT, 'Tk::Text', $tx; #script is called, runs, outputs to Scrolled above, user chooses new o +ption and sub clear() is called: sub clear{ $mainFrame ->destroy(); $tx ->pack('forget'); }
I want the $tx widget to disappear/clear off the screen
I have tried multiple things like forget, destroy, delete and anything else I could find on this site and around the interwebs. Some of them don't throw errors at all, but when I go to run a different script, the Scrolled widget/element will not clear from the screen so the new one shows up below the old one. I am relatively new to Perl GUI programming (this is my first GUI with Perl and I am trying to learn it as I go) so go easy on me
</code>In reply to Perl Tk Forgetting a Widget by amdme127
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |