I'm a novice with threads, but thought I understood enough to get a simple
threaded function working. However I can only get it to work using Tk and
not win32ui.

I'm trying to pop up a small topmost dialog or a window with an Ok button to
control the running of an app that itself runs Internet Explorer. When you
press the Ok button the app exits after processing whatever it was doing.

... at least it does with Tk but not with win32ui. I would very much
appreciate pointers to what I could do to make the first 'runOkThread' class
to work as well as the second.

Thank you as ever,
Geoff Gardiner


# main processing loop
while stillrunning:
    runOk = runOkThread()
    runOk.start()
    # do processing
    ...
    if not runOk.isAlive():
        stillrunning = 0

# example win32ui threading class
class runOkThread(threading.Thread):
    """
    Pop up a win32ui dialog. When the Ok button is pressed the thread stops.
    You can use this to stop the app. ... only ...
    This doesn't work - the message box never appears.
    """
    def run(self):
        dlg = win32ui.MessageBox('Press to stop', 'AppName',
                  win32con.MB_OK | win32con.MB_TOPMOST)

# alternative example Tk threading class
class runOkThread(threading.Thread):
    """
    Pop up a Tk dialog. When the Ok button is pressed the thread stops.
    You can use this to stop the app.
    This works except I don't know how to make it TOPMOST,
    and it doesn't work well through PythonWin.
    """
    def run(self):
        root = Tk()
        Button(root, text='Ok', command=exit).pack()
        root.mainloop()


_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to