#!/usr/bin/perl5.87 -w # ================================================================== # Prompt # GUI to ask user to confirm an action. # ================================================================== use strict; use Tk; if (defined $ARGV[0]) { $0 =~ s/.pl$//; die "Confirm:\n". "Useage: $0\n"; } my $GUI; my $mw; my $message = "Please verify that the task is complete."; $mw = MainWindow->new(-title => 'Confirm'); $mw->minsize('50','50'); $mw->protocol('WM_DELETE_WINDOW' => sub {print "0"; exit(0);}); my $bf = $mw->Frame->pack(qw/-side bottom -fill x/); $mw->Message(-text => $message, -width => 600) ->pack(qw/-anchor center -side top -fill x -expand 1/); $bf->Button(-text => 'NOT COMPLETE', -command => sub {exit(0);}) ->pack(qw/-side left -fill x -expand 1/); $bf->Button(-text => 'COMPLETE', -command => sub {exit(1);}) ->pack(qw/-side left -fill x -expand 1/); $mw->Popup; MainLoop; ############################################################## # End of main program ##############################################################