February 23rd, 2005, 04:24 PM
Is there anything in Python that works about the same way that Form_Unload() does in Visual Basic 6?
February 23rd, 2005, 05:19 PM
February 23rd, 2005, 05:44 PM
Just for the main Python "command prompt" thing.
February 23rd, 2005, 05:47 PM
well, from the title, it seems to be what you want to do is have something executed when the program is shutting down
If so, you could make a function and then assign all exiting to it (KeyboardInterrupt (Ctrl-C, etc), etc)
February 23rd, 2005, 06:29 PM
But what if someone pressed the X in the top right hand corner of the program, does that fall under KeyboardInterrupt also?
February 24th, 2005, 10:08 AM
do a try: finally: thing, that will force it to no matter what to do what you want on the exit of the program. So that will handing evyerhting
February 24th, 2005, 01:08 PM
I'd have to try it, but I'd suspect even a try: finally wont work.
Closing the command environment means there's nothing left for the end of your program to run in...
February 25th, 2005, 03:58 PM
ya your right about the user hiting the exit. I am not sure how you can do it for that. I guess must always make sure your stuff is saved? I really dont' know THat is a good question
February 25th, 2005, 04:31 PM
You want the atexit module.
Dave - The Developers' Coach
March 1st, 2005, 02:23 PM
Thanks Dave. It works perfectly.