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()