How to create modal windows with python 2.7 and TK

form1 is the main window.modform is the „child“ window.

from Tkinter import *
class form1:
def __init__ (self):
self.root = Tk()
self.ev1 = StringVar()
e1 = Entry(self.root,textvariable=self.ev1)
e1.pack()
e1.focus_set()
b1 = Button(self.root,text=“click“,command=lambda: self.b1_click()).pack()
self.root.mainloop()
def b1_click(self):
self.ev1.set(„test“)
mod = modform(self.root)

class modform:
def __init__(self,mroot):
self.mod = Toplevel()
self.ev1 = StringVar()
self.ev1.set(„modal“)
e1 = Entry(self.mod,textvariable = self.ev1)
e1.pack()
e1.focus_set()
b1 = Button(self.mod,text=“click“,command=lambda: self.b1_click()).pack()
self.mod.transient(mroot)
self.mod.grab_set()
mroot.wait_window(self.mod)
def b1_click(self):
self.mod.destroy()

f1 = form1()

PyGubu Protokoll Ereignis „Fenster schließen“ abfangen / Catch close window event with PyGubu

Leider ist die Doku von PyGubu etwas dürftig.
Nach langen Suchen habe ich gefunden, wie man das Schließen eines Frames abfängt :

The documentation of pygubu is not the best.
Perhaps there is any documentation about this event, but I ain’t found it until today.
Put this def in your app-class to handle the window closing event.

def on_close_execute(self):
print „End“
return pygubu.TkApplication.on_close_execute(self)