def EndDialogAfter(self, timeOut): #thread needed because win32gui does not expose SetTimer API import thread thread.start_new_thread(self.Timer, (timeOut, ))