'Initialize a dialog.
Arguments:
parent -- a parent window (the application window)
title -- the dialog title'

def __init__(self, parent, title=None):

    Toplevel.__init__(self, parent)
    self.withdraw()
    if parent.winfo_viewable():
        self.transient(parent)
    if title:
        self.title(title)
    self.parent = parent
    self.result = None
    body = Frame(self)
    self.initial_focus = self.body(body)
    body.pack(padx=5, pady=5)
    self.buttonbox()
    if (not self.initial_focus):
        self.initial_focus = self
    self.protocol('WM_DELETE_WINDOW', self.cancel)
    if (self.parent is not None):
        self.geometry(('+%d+%d' % ((parent.winfo_rootx() + 50), (parent.winfo_rooty() + 50))))
    self.deiconify()
    self.initial_focus.focus_set()
    self.wait_visibility()
    self.grab_set()
    self.wait_window(self)
