]> git.saurik.com Git - wxWidgets.git/commitdiff
Make the event ID used for wx.CallAfter be an attribute of the app so
authorRobin Dunn <robin@alldunn.com>
Sun, 21 Nov 2004 00:43:38 +0000 (00:43 +0000)
committerRobin Dunn <robin@alldunn.com>
Sun, 21 Nov 2004 00:43:38 +0000 (00:43 +0000)
when and addition all wx.App objects are created a new ID will be
generated.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/_core_ex.py

index 5d1dcd409daefdd753ce3927bb53415e9a8a34d9..855ba7e768d40374e788343db88ffe04033ddebd 100644 (file)
@@ -90,7 +90,6 @@ class _wxPyUnbornObject(object):
 
 
 #----------------------------------------------------------------------------
-_wxPyCallAfterId = None
 
 def CallAfter(callable, *args, **kw):
     """
@@ -104,19 +103,17 @@ def CallAfter(callable, *args, **kw):
     app = wx.GetApp()
     assert app is not None, 'No wx.App created yet'
 
-    global _wxPyCallAfterId
-    if _wxPyCallAfterId is None:
-        _wxPyCallAfterId = wx.NewEventType()
-        app.Connect(-1, -1, _wxPyCallAfterId,
-              lambda event: event.callable(*event.args, **event.kw) )
+    if not hasattr(app, "_CallAfterId"):
+        app._CallAfterId = wx.NewEventType()
+        app.Connect(-1, -1, app._CallAfterId,
+                    lambda event: event.callable(*event.args, **event.kw) )
     evt = wx.PyEvent()
-    evt.SetEventType(_wxPyCallAfterId)
+    evt.SetEventType(app._CallAfterId)
     evt.callable = callable
     evt.args = args
     evt.kw = kw
     wx.PostEvent(app, evt)
 
-
 #----------------------------------------------------------------------------