mmartin has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use Gtk2 -init; use Glib qw/TRUE FALSE/; my $window = Gtk2::Window->new('toplevel'); $window->signal_connect(destroy => sub {Gtk2->main_quit;}); #<---ERROR ### $window->show_all; my $msg_dialog = Gtk2::MessageDialog->new_with_markup($window, 'modal' +, 'error', 'yes-no', "Would you like to retry the connection?"); $msg_dialog->set_title("No Connection Found"); $msg_dialog->set_destroy_with_parent(TRUE); $msg_dialog->signal_connect (response => sub { my ($self, $response) = @_; if ($response eq 'yes') { $msg_dialog->hide(); my_function("yes"); } elsif ($response eq 'no') { $msg_dialog->destroy(); $window->destroy; } }); $msg_dialog->run(); Gtk2->main; 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Gtk2 - ->destroy() is Not Causing the Script to Exit
by mmartin (Monk) on May 02, 2014 at 20:19 UTC | |
by Anonymous Monk on May 02, 2014 at 21:37 UTC | |
|
Re: Perl Gtk2 - ->destroy() is Not Causing the Script to Exit
by sam_bakki (Pilgrim) on May 08, 2014 at 10:22 UTC |