[wxPython-users] return value from wx.CallAfter

甜瓜 littlesweetmelon at gmail.com
Sun Jan 13 20:36:30 PST 2008


Hi,
     I encountered the same problem with you. My solution may be not
very beautiful, but it works. ^_^ The key is to put the function
calling and result fetching together.

class MyThread(...):
     def __init__(...):
           self.event_append_finish = threading.Event()
     def doAppend(...):
           self.append_result = tree.AppendItem(...)
           self.event_append_finish.set()
     def some_func(...):
           wx.CallAfter(self.doAppend, ....)
           self.event_append_finish.wait()
           # read self.append_result...

---
ShenLei




More information about the wxpython-users mailing list