Dialog box strange behaviour
Colin Tuckley <[email protected]> Tue, 10 Jul 2007 19:54:44 +0100
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
I have an app which uses a "DialogBox as it's "About Application" box. I've noticed that if I close the application using the "X" close window button in the top right corner of the main window ehile the dialog is being displayed then although both the dialog and the main window close the application itself is still running. I can see this using ps and also because the xterm I started the app from doesn't give me a new prompt. Typing Ctrl-C in the xterm does then kill the application. Is this a bug or am I doing something wrong? System is Debian testing/lenny perl, v5.8.8 and perl-tk 804.027 Demo application attached. Colin -- Colin Tuckley | [email protected] | PGP/GnuPG Key Id +44(0)1903 236872 | +44(0)7799 143369 | 0x1B3045CE A door is what a cat is perpetually on the wrong side of. - adapted from Ogden Nash --++**==--++**==--++**==--++**==--++**==--++**==--++**== ptk mailing list [email protected] https://mailman.stanford.edu/mailman/listinfo/ptk
tkdtest
(text/plain, 1.4 KB)
#!/usr/bin/perl -w
use strict;
use Tk;
use Tk::Text;
use Tk::DialogBox;
my $about_box;
my $menu_help;
# then we need the main-window
my $mw = MainWindow -> new;
$mw -> title("Dialog test");
my $menu_frame = $mw -> Frame(-relief => 'raised', -bd => 2) -> pack(-side => 'top',
-fill => 'both',
-anchor => 'n');
$menu_frame -> Menubutton(-text => "File",
-underline => 0, -tearoff => 0,
-menuitems => [
['command' => "Exit",
-command => sub{&exit;},
-underline => 1]
]) -> pack(-side => 'left');
$menu_help = $menu_frame -> Menubutton(-text => "Help", -tearoff => 0,,
-underline => 0) -> pack(-side => 'left');
$menu_help -> command(-label => "About",
-command => \&about_window,
-underline => 0);
my $main_text = $mw->Text() -> pack;
$main_text -> insert('end', "Main Window\n");
MainLoop;
exit;
sub about_window {
$about_box = $mw->DialogBox(-title => 'About', -buttons => ['OK'], -default_button => 'OK');
my $text = $about_box -> Text() -> pack;
$text -> insert('end', "dialog test version: 0.1\n\n");
$text -> tagConfigure('red', -foreground => "#ff0000");
$text -> insert('end',"May the source be with you", 'red');
$about_box->Show();
}