[Tutor] Re: pausing time and perform on exit
Emile van Sebille
emile@fenx.com
Sat Nov 2 10:42:01 2002
> Kyle Babich:
> > Also how would I tell the program to do something when the program
is
> exited
> > by having the window closed to the computer shut down (anything with
> the
> > user manually typing 'quit' into the program)? I don't even know
> where to
> > begin with this.
This is even easier -- it's built in!
ActivePython 2.2.1 Build 222 (ActiveState Corp.) based on
Python 2.2.1 (#34, Apr 15 2002, 09:51:39) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import atexit
>>> def myexitfunc():print 'inmyexittfunc'
...
>>> atexit.register(myexitfunc)
>>> ^Z
inmyexittfunc
F:\Python22>
--
Emile van Sebille
emile@fenx.com
---------