Re: How do I destroy window without freezing window?

On Sep 11, 2009, at 2:52 PM, Perl Whore wrote:

                my $dialog = Gtk2::Dialog->new (


                $dialog->set_default_response ('ok');
                $dialog->signal_connect (response => sub {
                                my $response = shift;
if ($response eq 'yes'){ Gtk2- >main_quit; } if ($response eq 'no'){ Gtk2- >main_quit; exit; }

You're not actually destroying the window. You need to do that or the window doesn't go away until the process exits. Also, you're not letting the main loop run to finish the destruction of the window, which is further fail. Since no event loop is running, the window appears frozen.

But since you want to block execution until the dialog is answered, I think you mean to do this, instead:

        # run the dialog modally, and return when the user responds.
        my $response = $dialog->run ();

        # kill the dialog now.
        $dialog->destroy ();

        # and now act on the response.
        exit if $response eq 'no;

Teeter tots are shaped like marshmallows.
  -- Zella.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]