]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/msw/wx.py
Some improvements and additions for wxListCtrl and logging
[wxWidgets.git] / wxPython / src / msw / wx.py
index 0eb6913050baa6a3f149024239e50c4b0b86ee00..148ac8b3ee614a05fe962f66abac0bdc825bc958 100644 (file)
@@ -467,6 +467,8 @@ wxMM_ISOTROPIC = wxc.wxMM_ISOTROPIC
 wxMM_ANISOTROPIC = wxc.wxMM_ANISOTROPIC
 wxMM_POINTS = wxc.wxMM_POINTS
 wxMM_METRIC = wxc.wxMM_METRIC
+wxTIMER_CONTINUOUS = wxc.wxTIMER_CONTINUOUS
+wxTIMER_ONE_SHOT = wxc.wxTIMER_ONE_SHOT
 wxBORDER_DEFAULT = wxc.wxBORDER_DEFAULT
 wxBORDER_NONE = wxc.wxBORDER_NONE
 wxBORDER_STATIC = wxc.wxBORDER_STATIC
@@ -1569,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