Threading question

Hello,

I'm trying here first, since I guess threading issues may have a python bent...

I am trying to close a modal dialog from a seperate thread. Below is a simple example of how I understand it should work.
Can anyone see something blatantly wrong?

Thanks
-i

···

-----------------------
import wx
import threading
import time

wx.PySimpleApp()

dialog = wx.Dialog(None, -1, '')

def close():
    time.sleep(1)
    event = wx.CloseEvent()
    wx.PostEvent(dialog, event)

threading.Thread(target=close).start()
dialog.ShowModal()

---------------------------

Powered by Tiscali - http://www.tiscali.co.za