]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_extras.py
compilation error fix (trailing comma in an enum)
[wxWidgets.git] / wxPython / src / _extras.py
index fd014225e52cf650c9d0829b6aaa6cdc3576cfd8..5289d06a0eb4453f8ed7c89c78fbdc5d262ae175 100644 (file)
@@ -654,6 +654,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