in reply to tk close window

Let's back off. This code worked on windows 7, with strawberry perl 5.12.1 and Tk 804.029.

It worked in the sense that there were two (not one) X buttons - one for the dialog and one for the main window, and both responded to click event.

I think you need to tell more about your environment, so someone with a similar onfiguration can try for you.

Peter (Guo) Pei

Replies are listed 'Best First'.
Re^2: tk close window
by fanticla (Scribe) on Nov 07, 2010 at 21:20 UTC

    I'm running the script on XP and Perl 5.8.8

    I found the following work around (using protocol('WM_DELETE_WINDOW'):

    use warnings; use strict; use Tk; use Tk::Dialog; my $mw = MainWindow->new(); my $dialog_setup = $mw->Dialog(-title => "My Window", -background=>"wh +ite",-buttons => [qw/Ok Quit/]); $dialog_setup->protocol('WM_DELETE_WINDOW', \&destroy_dialog); my $answer = $dialog_setup->Show(); if ($answer=~ /Ok/){ do_something();} MainLoop(); sub destroy_dialog { $dialog_setup ->destroy; }