Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Program with Tk::TOTD not exiting properly

by ric00015 (Beadle)
on Nov 01, 2013 at 17:57 UTC ( #1060803=perlquestion: print w/replies, xml ) Need Help??

ric00015 has asked for the wisdom of the Perl Monks concerning the following question:

Earlier I asked about how to get a popup screen with help, and a checkbox "Check to show on startup" type thing. I was told about Tk::TOTD, and it works nicely. However, for some reason, when the program ends, it doesn't seem to return control to the shell that called it once the program exits. The effect is reproducible in the following code:

#!/usr/bin/env perl use strict; use warnings; use utf8; use Tk; use Tk::TOTD; my $mw = MainWindow->new; my $label = $mw->Label( -text => 'hi!')->pack; my $entry = $mw->Entry()->pack; my $button = $mw->Button( -text => 'push me!')->pack; my @messages = ( 'message 1', 'message 2', 'message 3'); my $totd = $mw->TOTD ( -title => 'Tip Of The Day', -messages => \@messages); $totd->Show; MainLoop;

Replies are listed 'Best First'.
Re: Program with Tk::TOTD not exiting properly
by Kirsle (Pilgrim) on Nov 01, 2013 at 21:09 UTC

    Confirmed bug.

    The problem is reproduced when you use the in-dialog "Close" button to dismiss the dialog. Clicking your window manager's "X" button doesn't reproduce the problem.

    The root cause is that the "Close" button calls destroy() on the dialog, and the underlying DialogBox doesn't like this, because it calls WaitVariable and waits forever. Instead, I set the "selected_button" attribute of the DialogBox, which causes the DialogBox to close itself gracefully.

    See: 8fa6e213.

    I've uploaded Tk::TOTD 0.3 to CPAN that fixes this issue.

Re: Program with Tk::TOTD not exiting properly
by kcott (Bishop) on Nov 01, 2013 at 19:47 UTC

      Thanks for checking. I sent off a report, but until I hear back, I'll have to find another solution.

        I've fixed the bug and uploaded version 0.3 to CPAN just now.

        This project has also been moved to git, where you can get the latest version in the meantime:

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1060803]
Front-paged by Arunbear
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2021-10-21 21:54 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (85 votes). Check out past polls.