tkinter:

Markus von Ehr vonehr at ira.uka.de
Tue Feb 13 11:55:56 EST 2001


Hi,

I have a class that creates a toplevel window and want to destroy the
toplevel
from a thread within this class.
I get an error in python.exe, does anybody know why and how I can
destroy the toplevel in this thread?

class MyWindow:
    def __init__(self, root, duration):

        self.duration = int(duration * 10 + 0.5)
        self.toplevel = Toplevel(root)
        thread.start_new_thread(self.my_thread, (10,))

    def my_thread(self, start):
        time.sleep(self.duration)
        self.toplevel.grab_release()
        self.root.focus_set()
        self.root.focus_set()
        self.toplevel.destroy()

Thanks for any answer,

Markus





More information about the Python-list mailing list