]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/mac/wx.py
SWIGged update for wxMac
[wxWidgets.git] / wxPython / src / mac / wx.py
index 5503c00d601d5c94b5baa30e45bebac034ce39e4..5e6aee58404b25dda1aac3d38b7a218b6ddb66d1 100644 (file)
@@ -1565,6 +1565,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