jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed Monks,

In the following code a button is placed in a grid inside a frame inside a NoteBook tab.

sub doFileImportUi { my ($pg, $dbh) = @_; $pg->Label(-text => 'File', -width => '10')->grid( $pg->LabEntry(-width => '30', -textvariable => \$state->{ImpFi +le}), $pg->Button(-text => 'Browse', -command => [ \&getImportFile, $ +pg, $dbh], -width => '10')); $pg->Label(-text => 'DataSource', -justify => 'right', -width => ' +20') ->grid(my $ds_list = $pg->BrowseEntry(-variable => \$state +->{dsSrcName}, -browsecmd => \&doGetDatasource, -listcmd => [ \&doLoa +dDs, $pg, $dbh ], -width => '20'), -sticky => 'w'); my $gbtn = $pg->Button(-text => 'Next Phase')->grid(); $gbtn->configure( -command => [ \&doImportFile, $pg, $dbh, $gbtn +]); my @listname = &doLoadDs($pg, $dbh); $ds_list->insert('end', @listname); }
When I click on that button and go to the doImportFile() sub I want to remove the button. According to the grid manpage it is possible, but if I use this code, which seems plausible according to the manpage:
Then I get the error:
--- Begin Traceback --- Failed to AUTOLOAD 'Tk::Frame::gridRemove' at line 437 Carp::croak at K:/Perl/lib/ line 191 Tk::Widget::__ANON__ at K:/Perl/site/lib/Tk/ line 338 main::doImportFile at line 437 [\&main::doImportFile,{},{},{}] Tk callback for .notebook.page4.button1 Tk::__ANON__ at K:/Perl/site/lib/ line 228 Tk::Button::butUp at K:/Perl/site/lib/Tk/ line 111 (command bound to event)
Does any one have a suggestion to offer about how to remove the button from the window?