Threaded decorators which return objects

Frank Aune Frank.Aune at broadpark.no
Mon Oct 29 16:03:01 PDT 2007


Hi,

How do I make a threaded decorator:

def Threaded(f):
    """ Decorator function to spawn methods into separate threads """
    def wrapper(*args, **kwargs):
        t=threading.Thread(target=f, args=args, kwargs=kwargs)
        t.setDaemon(True)
        t.start()
    return wrapper

return values to its caller? Say I create a MessageDialog in a decorated 
function, and want to receive the dlg value from the above wrapper.

Thanks,
Frank




More information about the wxpython-users mailing list