Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Perl/Tk and exit(0)

by jcb (Parson)
on Apr 03, 2020 at 01:56 UTC ( [id://11114970]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Perl/Tk and exit(0)
in thread Perl/Tk and exit(0)

All UI activity in Tk occurs in the Tk event loop. You are exiting the program from an event handler before returning control to the event loop. Try replacing that handler with sub {&checkDays; $mw->after(5000, sub {exit(0)});} and see Tk::after for more details.

Replies are listed 'Best First'.
Re^4: Perl/Tk and exit(0)
by saw55 (Novice) on Apr 03, 2020 at 04:46 UTC

    Thanks for the reply, but I could use some clarification if you could. Are you saying I should replace

    $svBtn = $mw->Button( -text => "SAVE", -command => sub {&checkDays; exit(0);});

    with

    $svBtn = $mw->Button( -text => "SAVE", -command => sub {&checkDays; $mw->after(5000, sub {exit(0)});}

    When I do that I get an error saying "Scalar found where operator expected" at the next line, near "$mw" I guess I am sort of lost.

      missing ); on replacement statement;

        Thanks so much! I feel kind of foolish for missing something so simple--I should have turned on "highlight matching brackets" on my editor.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11114970]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (1)
As of 2024-04-25 00:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found