]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/msw/wx.py
Fixed "different linkage" compile error
[wxWidgets.git] / wxPython / src / msw / wx.py
index ae2194e9f7907a3f8af6b622b1fb2d8057777db3..148ac8b3ee614a05fe962f66abac0bdc825bc958 100644 (file)
@@ -1571,6 +1571,29 @@ def wxPyTypeCast(obj, typeStr):
 
 
 #----------------------------------------------------------------------------
+_wxCallAfterId = None
+
+def wxCallAfter(callable, *args, **kw):
+    """
+    Call the specified function after the current and pending event
+    handlers have been completed.
+    """
+    app = wxGetApp()
+    assert app, 'No wxApp created yet'
+
+    global _wxCallAfterId
+    if _wxCallAfterId is None:
+        _wxCallAfterId = wxNewId()
+        app.Connect(-1, -1, _wxCallAfterId,
+              lambda event: apply(event.callable, event.args, event.kw) )
+    evt = wxPyEvent()
+    evt.SetEventType(_wxCallAfterId)
+    evt.callable = callable
+    evt.args = args
+    evt.kw = kw
+    wxPostEvent(app, evt)
+
+#----------------------------------------------------------------------
 
 class wxPyDeadObjectError(AttributeError):
     pass