Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

TK close window int signal

by Stoney2005 (Acolyte)
on May 29, 2011 at 03:44 UTC ( #907190=perlquestion: print w/ replies, xml ) Need Help??
Stoney2005 has asked for the wisdom of the Perl Monks concerning the following question:

So i'm trying to set up signal handlers for the script i'm setting up. i'm currently having it catch normal-signals, error-signals, and old-interface-signals. Yeah there is some overlapping stuff but its not a big deal for me. So my question is when you close a normal tk window such as
use Tk; $mw = new MainWindow; #Initialize main window $mw->withdraw(); $mw->Popup; MainLoop;

What signal is it recieving when you click the window close button on the upper right hand side?

Comment on TK close window int signal
Download Code
Re: TK close window int signal
by Anonymous Monk on May 29, 2011 at 03:46 UTC
    What signal is it recieving when you click the window close button on the upper right hand side?

    None. Tk doesn't use signals.

      To elaborate, MainLoop is responsible for processing GUI messages. Closing the last toplevel window, ends the MainLoop.
      $ perl -MTk -e " tkinit->MainLoop; die qq[hi] " hi at -e line 1.
Re: TK close window int signal
by didier (Vicar) on May 29, 2011 at 09:23 UTC
    $mw->protocol('WM_DELETE_WINDOW',[\&stop]); sub stop{ $mw -> destroy; }

Re: TK close window int signal
by deep3101 (Acolyte) on May 29, 2011 at 16:29 UTC
Re: TK close window int signal
by Stoney2005 (Acolyte) on May 30, 2011 at 23:29 UTC
    well damn. i know i wrote a post earlier explaining what i tried. mehhh. well i did it now. $mw->protocol('WM_DELETE_WINDOW',\&clean_exit);
    the [] brackets threw me off and broke the code
      There is no need for any of that, just call exit after MainLoop
      Main ( @ARGV ); exit ( 0 ); sub Main { ... MainLoop; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://907190]
Approved by Gangabass
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (13)
As of 2014-08-22 14:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (158 votes), past polls