When running the example below I get the error:
Example.Tk::Error: window ".toplevel.frame1.hlist.menu" was deleted before its + visibility changed at C:/Dwimperl/perl/site/lib/Tk/Widget.pm line 10 +00. Tk callback for tkwait <Button-1> (command bound to event)
#!/usr/bin/perl -w use strict; use Tk; use Tk::Pane; use Tk::HList; sub door { my $house = shift; my $door_W = $house->Toplevel(); my $hlist = $door_W->Scrolled( 'HList', -scrollbars => "se", -columns => 1, -header => 1, )->pack( -expand => 1, -fill => 'both'); $hlist->headerCreate(0, -text => 'Title'); $hlist->columnWidth(0, ''); $hlist->bind("<Button-1>" => [\&knock_on_door, $door_W]); my $exit_B = $door_W->Button( -text => 'Exit', -command => sub { $door_W->destroy(); }, -relief => 'raised', )->pack(-side => 'left'); } sub knock_on_door { my $frame = shift; my $pop_menu = $frame->Menu( -menuitems => [ ['command', 'Knock on door.', -command => sub { print "Knock! Knock!!!\n"; } ], '', ] )->Popup(-popover => "cursor", -popanchor => 'nw'); $pop_menu->destroy; } my $mw = MainWindow->new; $mw->Button(-text => "Close", -command =>sub{exit})->pack(); door($mw); MainLoop;
You receive the error after selecting "knock on door" and pushing the Exit button.
You don't recieve the error if you only push the Exit button.
I am running TK 804.032
Thankful for any ideas.
Thomas
In reply to Why does widget->destroy give the error Tk::Error widget was deleted before its visibility changed? by thomas.bystrom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |