import time, thread from Tkinter import * class ExampleError: def __init__(self): self.parentContainer = Tk() self.parentContainer.protocol('WM_DELETE_WINDOW', self.quitPressed) self.parentContainer.wm_geometry("500x400") self.parentContainer.title("Parent Container Title") self.container = Frame(self.parentContainer) self.messageBoxDetails = Text(self.container, wrap=WORD, width=1, height=1, padx=10, pady=10) # in python 2.6, this next statement hangs when running as a thread - note that # inserting an empty string works though self.messageBoxDetails.insert(INSERT, "Hello world") self.messageBoxDetails.pack(fill=BOTH, expand=YES, side=LEFT) self.container.pack(fill=BOTH, expand=YES, padx=5, pady=5) def quitPressed(self): self.stop() def start(self): self.parentContainer.mainloop() def stop(self): self.parentContainer.quit() self.parentContainer.destroy() if __name__ =="__main__": example = ExampleError() thread.start_new_thread(example.start, ()) time.sleep(5)