PATH:
usr
/
lib64
/
python2.7
/
Demo
/
tkinter
/
matt
from Tkinter import * # This file shows how to trap the killing of a window # when the user uses window manager menus (typ. upper left hand corner # menu in the decoration border). ### ******* this isn't really called -- read the comments def my_delete_callback(): print "whoops -- tried to delete me!" class Test(Frame): def deathHandler(self, event): print self, "is now getting nuked. performing some save here...." def createWidgets(self): # a hello button self.hi_there = Button(self, text='Hello') self.hi_there.pack(side=LEFT) def __init__(self, master=None): Frame.__init__(self, master) Pack.config(self) self.createWidgets() ### ### PREVENT WM kills from happening ### # the docs would have you do this: # self.master.protocol("WM_DELETE_WINDOW", my_delete_callback) # unfortunately, some window managers will not send this request to a window. # the "protocol" function seems incapable of trapping these "aggressive" window kills. # this line of code catches everything, tho. The window is deleted, but you have a chance # of cleaning up first. self.bind_all("<Destroy>", self.deathHandler) test = Test() test.mainloop()
[-] canvas-gridding.py
[edit]
[-] radiobutton-simple.py
[edit]
[-] canvas-gridding.pyc
[edit]
[-] two-radio-groups.pyo
[edit]
[-] rubber-band-box-demo-1.py
[edit]
[-] rubber-line-demo-1.py
[edit]
[-] canvas-moving-or-creating.pyo
[edit]
[-] 00-HELLO-WORLD.py
[edit]
[-] window-creation-w-location.pyc
[edit]
[-] canvas-moving-w-mouse.py
[edit]
[-] animation-simple.py
[edit]
[-] canvas-moving-w-mouse.pyc
[edit]
[-] canvas-moving-w-mouse.pyo
[edit]
[-] animation-w-velocity-ctrl.py
[edit]
[+]
..
[-] canvas-demo-simple.pyc
[edit]
[-] not-what-you-might-think-2.pyc
[edit]
[-] packer-simple.pyc
[edit]
[-] two-radio-groups.py
[edit]
[-] rubber-line-demo-1.pyc
[edit]
[-] menu-all-types-of-entries.py
[edit]
[-] killing-window-w-wm.pyc
[edit]
[-] README
[edit]
[-] canvas-moving-or-creating.pyc
[edit]
[-] animation-simple.pyo
[edit]
[-] packer-and-placer-together.py
[edit]
[-] animation-w-velocity-ctrl.pyc
[edit]
[-] pong-demo-1.pyc
[edit]
[-] rubber-band-box-demo-1.pyc
[edit]
[-] two-radio-groups.pyc
[edit]
[-] menu-all-types-of-entries.pyc
[edit]
[-] slider-demo-1.py
[edit]
[-] packer-simple.py
[edit]
[-] printing-coords-of-items.pyo
[edit]
[-] dialog-box.pyo
[edit]
[-] entry-simple.pyo
[edit]
[-] subclass-existing-widgets.pyc
[edit]
[-] window-creation-more.pyc
[edit]
[-] dialog-box.pyc
[edit]
[-] not-what-you-might-think-1.pyc
[edit]
[-] radiobutton-simple.pyo
[edit]
[-] canvas-moving-or-creating.py
[edit]
[-] placer-simple.pyc
[edit]
[-] menu-simple.pyo
[edit]
[-] rubber-band-box-demo-1.pyo
[edit]
[-] canvas-gridding.pyo
[edit]
[-] placer-simple.py
[edit]
[-] animation-w-velocity-ctrl.pyo
[edit]
[-] canvas-reading-tag-info.pyo
[edit]
[-] canvas-with-scrollbars.pyc
[edit]
[-] killing-window-w-wm.py
[edit]
[-] window-creation-w-location.py
[edit]
[-] not-what-you-might-think-2.pyo
[edit]
[-] entry-simple.pyc
[edit]
[-] entry-simple.py
[edit]
[-] rubber-line-demo-1.pyo
[edit]
[-] subclass-existing-widgets.pyo
[edit]
[-] window-creation-simple.pyo
[edit]
[-] canvas-mult-item-sel.pyo
[edit]
[-] window-creation-simple.pyc
[edit]
[-] canvas-w-widget-draw-el.pyc
[edit]
[-] canvas-with-scrollbars.pyo
[edit]
[-] window-creation-more.pyo
[edit]
[-] canvas-mult-item-sel.pyc
[edit]
[-] canvas-reading-tag-info.pyc
[edit]
[-] killing-window-w-wm.pyo
[edit]
[-] bind-w-mult-calls-p-type.pyo
[edit]
[-] entry-with-shared-variable.py
[edit]
[-] 00-HELLO-WORLD.pyc
[edit]
[-] canvas-with-scrollbars.py
[edit]
[-] pong-demo-1.pyo
[edit]
[-] window-creation-more.py
[edit]
[-] slider-demo-1.pyc
[edit]
[-] menu-simple.py
[edit]
[-] animation-simple.pyc
[edit]
[-] subclass-existing-widgets.py
[edit]
[-] canvas-w-widget-draw-el.pyo
[edit]
[-] packer-and-placer-together.pyc
[edit]
[-] bind-w-mult-calls-p-type.pyc
[edit]
[-] not-what-you-might-think-1.py
[edit]
[-] not-what-you-might-think-2.py
[edit]
[-] window-creation-simple.py
[edit]
[-] canvas-mult-item-sel.py
[edit]
[-] bind-w-mult-calls-p-type.py
[edit]
[-] entry-with-shared-variable.pyc
[edit]
[-] radiobutton-simple.pyc
[edit]
[-] dialog-box.py
[edit]
[-] menu-all-types-of-entries.pyo
[edit]
[-] canvas-demo-simple.pyo
[edit]
[-] menu-simple.pyc
[edit]
[-] slider-demo-1.pyo
[edit]
[-] canvas-w-widget-draw-el.py
[edit]
[-] 00-HELLO-WORLD.pyo
[edit]
[-] canvas-demo-simple.py
[edit]
[-] packer-simple.pyo
[edit]
[-] printing-coords-of-items.py
[edit]
[-] printing-coords-of-items.pyc
[edit]
[-] canvas-reading-tag-info.py
[edit]
[-] window-creation-w-location.pyo
[edit]
[-] not-what-you-might-think-1.pyo
[edit]
[-] pong-demo-1.py
[edit]
[-] entry-with-shared-variable.pyo
[edit]
[-] packer-and-placer-together.pyo
[edit]
[-] placer-simple.pyo
[edit]