Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103421

Re: [Newbie] Tkinter Question

From Christian Gollwitzer <auriocus@gmx.de>
Newsgroups comp.lang.python
Subject Re: [Newbie] Tkinter Question
Date 2016-02-23 23:37 +0100
Organization A noiseless patient Spider
Message-ID <naimpd$4pf$1@dont-email.me> (permalink)
References <Ye-dnZQLyOFiR1HLnZ2dnUU7-YPOydjZ@giganews.com>

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[Newbie] Tkinter Question Wildman <best_lay@yahoo.com> - 2016-02-23 16:19 -0600
  Re: [Newbie] Tkinter Question Christian Gollwitzer <auriocus@gmx.de> - 2016-02-23 23:37 +0100
  Re: [Newbie] Tkinter Question Chris Kaynor <ckaynor@zindagigames.com> - 2016-02-23 14:41 -0800
  Re: [Newbie] Tkinter Question Wildman <best_lay@yahoo.com> - 2016-02-24 23:13 -0600
    Re: [Newbie] Tkinter Question Randy Day <randy.day@sasktel.netx> - 2016-02-25 11:13 -0600

csiph-web