def METHOD_NAME(self, event=None):
    if not self.validate():
        self.initial_focus.focus_set() # put focus back
        return
    self.withdraw()
    self.update_idletasks()
    try:
        self.apply()
    finally:
        self.cancel()