Fixing Leo and Idle OS shutdown bug?
dig.list at telkel.net
Wed Aug 7 22:10:40 CEST 2002
Hi, Edward K. Ream !
On Wed, Aug 07, 2002 at 02:30:42PM +0000, Edward K. Ream wrote:
> Leo does not prompt the user to save unsaved files when Windows 2K or XP is
> shutting down. Neither does IDLE.
> Is there any way to interrupt the shutdown process in TK? I have tried
> binding to Destroy or WM_DELETE_WINDOW for the top level window, like this,
> with no effect:
> root.bind("<Destroy>", onKillLeoEvent)
> root.protocol("WM_DELETE_WINDOW", onKillLeoEvent)
> Heck, this code doesn't even fire when I close Leo the regular way.
> Does anyone know of a way to get the job done? Thanks.
This works for me (linux 2.2.16, python 1.5.2):
--- 8< --- --- 8< --- --- 8< ---
#! /usr/bin/env python
# File: wm-close.py
def on_close( ):
if tkMessageBox.askokcancel( "Quit", "I am about to quit." ):
root = tk.Tk( )
root.protocol( "WM_DELETE_WINDOW", on_close )
--- >8 --- --- >8 --- --- >8 ---
DIG (Dmitri I GOULIAEV)
More information about the Python-list