Am 23.02.16 um 23:19 schrieb Wildman:
I am familiar with OO programming but I am new to Python
and Tkinter.  I am working on a gui program that creates
a couple of temporary files.  As part of the Exit button
command they are deleted.  If the program is shut down
using the window close button [X], the exit button code
is not executed and the temporary files are left behind.
That is a serious no-no.

Is there a way to capture close button click to prevent
the program from closing and instead execute a command?

It's done using the WM_DELETE_WINDOW protocol:

http://stackoverflow.com/questions/111155/how-do-i-handle-the-window-close-event-in-tkinter

Your program could still be killed by another way, e.g. from the task manager, which would leave the files behind.

        Christian
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to